4 ms·
Well, that has been done for decades. You just need to link your code with the correct libraries. Its probably a bit easier with C as it has a common ABI, and
by meetingcpp 11y ago
Well, that has been done for decades. You just need to link your code with the correct libraries.
Its probably a bit easier with C as it has a common ABI, and C# as it only has one tool chain, and not multiple toolchains from multiple vendors like C++.
Modules will help here further.
- kevinnk 11y agoI believe maxxxxx is asking about the ability to import and use classes from a DLL directly, without needing a class definition. As far as I know, in standard C++ this isn't possible.
- meetingcpp 11y agoYes, that is correct. That is not possible, modules might offer things in this direction.
- maxxxxx 11y agoYes, that's it. Thank you! This is the one thing I really like about .NET. C++ would be so much more accessible to beginners if it was easier to integrate other libraries. Even integrating something as common as boost is quite hard with Visual Studio on Windows.
- kazinator 11y agoC++ doesn't define any object format, period. A C++ implementation could provide translated units which encapsulate not only compiled code, but also contain compiled class declarations, such that these units can just be used without any preprocessing, tokenizing or parsing. That would be outside the language. The C++ language as it stands is defined in terms of a textual representation: everything proceeds from translation units being scanned into preprocessing tokens and so forth. To use a compiled class declaration, you would still need to see the source code somewhere, in some form, in some documentation. Otherwise, how would you know that the frobozz class has a freakout method which accepts two int parameters.
- Kliment 11y agoAbout the last bit, a long time ago I would use the ctypes library in Python to inspect, list, and call functions defined in .DLLs. All the symbol exports are right there in the object file, so for non-C++ callers you don't exactly need the source code to call functions. It doesn't seem like a large stretch to ask whether the same thing can be done with classes, or to expect that this particular aspect would have changed sometime in three iterations of the standard.
- deleted 11y ago[deleted]