3 ms·
Yeah, I saw the title and was excited, then I saw #ifdef __cplusplus extern "C" { #endif This makes it C interop. If it were C++ interop, I would
by snarfy 8y ago
Yeah, I saw the title and was excited, then I saw
#ifdef __cplusplus
extern "C" {
#endif
This makes it C interop.
If it were C++ interop, I would be able to DllImport a C++ library (without the C linkage) and get a C# wrapper class of the C++ classes automatically.
It's not C#'s fault. C++ is the one without an ABI. To properly DllImport C++ you would need to define the so/dll name in the import and also the specific C++ compiler version and build, since the binary changes underneath, e.g. foo.msvc_x64_debug.dll, foo.gcc_x86_release.dll, etc. Then C# might have a chance of importing a c++ library, but not today.
- sebazzz 8y ago> If it were C++ interop, I would be able to DllImport a C++ library (without the C linkage) and get a C# wrapper class of the C++ classes automatically. If you count COM as being C++, it would be possible.