3 ms·
C++/CLI is C++ compiled to NET CLR IL, so it has all the features of the regular C++ compiler (templates) AND all the features of the CLR (generics). It is an
by tsimionescu 5y ago
C++/CLI is C++ compiled to NET CLR IL, so it has all the features of the regular C++ compiler (templates) AND all the features of the CLR (generics).
It is an extremely niche language, extremely rarely used even in the .NET ecosystem, except sometimes as glue code.
Normal C++, including MSVC C++, has only templates.
- pjmlp 5y agoIt is definitely nicer than trying to correctly get P/Invoke declarations or debug COM marshaling issues. This is the kind of tooling that makes me still reach out for C++ when going outside managed languages.
- tsimionescu 5y agoMy experience was that P/Invoke is much easier, but of course YMMV. COM I never played around with. I also found a pretty ugly bug in the C++/CLR compiler - if you used in-place initialization for an array (something like auto arr = Object[]{obj1}), it would allocate an array of length 0xC0FFEE and set the elements you specified. They acknowledged the bug but said they will only fix it in a future version of the language. This told me all I needed to know about how popular it actually was.
- pjmlp 5y agoIt is popular enough for being one of the major milestones on .NET Core 3.1. P/Invoke can only do so much if a C++ library doesn't provide a C ABI, and WinDev loves to publish COM based APIs since they won the Longhorn dispute.