Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C++ 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


C++/CLI works perfectly fine on Windows, it was a major milestone for .NET Core 3.0.

And then there is WinRT/COM as well.


Indeed, 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.


Ok C++/CLI can be considered C++ interop but it's really compiling the C++ code again with some limitations.


Nope, it is compiling C++ with extra features, not limitiations.

Unless you mean pure safe assemblies.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: