3 ms·
C++/CLI is managed code, it’s basically C++ compiled into .NET IL. If you’re writing C++ code running on .NET / .NET Framework, you’re basically writing masoch
by smileybarry 2y ago
C++/CLI is managed code, it’s basically C++ compiled into .NET IL.
If you’re writing C++ code running on .NET / .NET Framework, you’re basically writing masochistic C#.
- alkonaut 2y agoBut why even use C++ for the front end if it’s going to be .NET? Managed C++ is mostly useful as a shim, not as a platform language. It’s not really an alternative to C# on the .NET runtime but just some C++ extensions for interop with it. If you make a WPF/WinForms frontend then that should be the exe entry point, and that would likely be managed. Then your business logic would be the auxiliary DLL (which can be embedded into the managed exe). There could be a layer of C++/CLI between these to layers (C# front end and native backend) because it would make the interop a bit easier than having to do C-style interop.
- smileybarry 2y ago> But why even use C++ for the front end if it’s going to be .NET? Because the author of the article wanted to use C++, I don’t know why. That’s why I called it “masochistic C#”.
- pjmlp 2y agoActually I find it much easier to write C++/CLI, than getting right all P/Invoke marshaling, specially if COM is also part of the picture. Also C++/CLI can also generate native code when specific code patters are used, that is why there are some compiler flags to disable it, and such assemblies are considered unsafe.