C++/CLI is based on C++, modified to allow compilation of a mixture of native code and code for Microsoft's Common Language Infrastructure (CLI). It replaces Microsoft's Managed Extensions for C++, which aimed for stronger C++ conformance.
C++/CLI is a programming language based on C++ (ISO/IEC 14882:2003) which targets a mixed native+CLI platform. It was originally developed by Microsoft and supersedes "Managed Extensions for C++". It is formally standardized in Standard ECMA-372.
The Common Language Infrastructure (CLI) is a standardized specification for a runtime environment. Its principal implementation is Microsoft's .NET platform, but alternative implementations such as Mono exist. CLI executables are stored in bytecode in the "Common Intermediate Language" (CIL) that is run by a virtual machine and assembled by the "Intermediate Language Assembler" (ILASM).
There are multiple programming languages that emit pure CIL bytecode, for example C#. C++/CLI on the other hand can emit both native code (the C++-compatible parts of the program) and CLI code.
It has two distinct heaps, the familiar (native) C++ heap and the garbage-collected CLI heap. The language adds new features to properly deal with these two disparate concepts, while treating them as uniformly as possible. Both C++ pointers Foo * p
and CLI references Bar ^ q
are dereferenced the same way, *p = 1
/ *q = 2
and p->f()
/ q->g()
.
C++/CLI compiles most standard C++ programs out of the box, while simultaneously opening up access to the very large CLI library.