3 ms·
C++ interop?
by kyberias 6y ago
C++ interop?
- Const-me 6y agoC++ interop is not supported in modern .NET out of the box, but wasn't too hard to implement as a library: https://github.com/Const-me/ComLightInterop https://github.com/Const-me/ComLightInterop
- pjmlp 6y agoC++/CLI works perfectly fine on Windows, it was a major milestone for .NET Core 3.0. And then there is WinRT/COM as well.
- kyberias 6y agoOk C++/CLI can be considered C++ interop but it's really compiling the C++ code again with some limitations.
- pjmlp 6y agoNope, it is compiling C++ with extra features, not limitiations. Unless you mean pure safe assemblies.
- Const-me 6y agoIndeed, on Windows there’s no need for that library. But on Linux, none of that is available. I have used C++/CLI long ago for a couple of minor things, and I didn’t like it. The two runtimes, C++ and .NET, are interacting in a weird way, I got an impression it combines worst parts from both C# and C++ languages. I prefer IUnknown-based COM interfaces ever since. With some care about API design, C# side of the interop is only marginally more complex that it would be with C++/CLI, but unmanaged side is much easier in regular C++, without the CLI.