For what is C + +/CLI, we can first simply divide its name into two parts to understand, first, C + +, we are familiar with the now widely used high-level language of the object-oriented ISO international standard, also known as isoc++, we hereafter call it isoc++; second, CLI, We can feel that it is extended to isoc++ on the CLI. The CLI is the abbreviation for the Universal language framework, Microsoft's. NET is the architecture on the CLI, although the CLI is now the ISO standard, but C + +/CLI is not an extension of the Isoc++ committee, so C + +/CLI is not the new version of the isoc++ standard, it is only Microsoft pin his CLI implementation of. NET extension. Although C + +/CLI is not an ISO standard at the moment, C + +/CLI combines isoc++ and. NET with super power, which is doomed to be overlooked by us.
In fact, in addition to the isoc++ and CLI extensions, and the more important reason why C + + is powerful, it implements a seamless connection between isoc++ and. Net. The following are specific to these three aspects:
1) isoc++ language
We know that C + + is an ISO object-oriented language, and for this language we also see from the following three aspects, it is these three main aspects of the decision he is widely used. First, C + + is a powerful language. For example, the C + + language itself provides embedded types, arrays, structs and pointers, etc., and C + + has a new object-oriented class, inheritance, polymorphism, and template, and the C + + Standard Template Library (STL) provides the actual development of data structures and algorithms that are often used in the implementation; second, A large number of open source and third-party libraries, assuming the use of C + + development on windows, first we can leverage Microsoft's strong support for C + +, such as the VS compiler, the UI library MFC, ATL, etc. In addition, we can see many other non-Microsoft open source and third-party support, such as boost to a large extent the expansion of STL, provide many other more advanced features, as well as Loki C + + design patterns together, there are a lot of third-party UI library, For example, QT,WXWINDOWS,WTL,GTK, third-party network communication library, such as Ace,streammodule, third-party XML library, such as Xerces,cmarkup,tinyxml, third-party scientific Computing library, such as blitz++, MTL, third-party game development Library, such as Ogre,klayge, third-party line libraries, such as C + + threads,zthreads, there are many others; third, the high performance of C + +. This feature of C + + is no doubt, we know that most of the operating system, embedded development, game, image software inseparable from C + +, which is the high performance of C + + has a very big relationship, from this point of view, this is very much modern other high-level language is missing, it is this is destined for C + + There is still a very long way to go.
2) CLI
The CLI (Common Language Infrastructure, Common language framework) provides a set of executable code and specifications for the virtual execution environment that it performs. More popular we can say that it is a virtual platform, a layer of abstraction between the operating system and the application. Microsoft's. NET's underlying CLR (Common Language Runtime, Common language execution) is an instance of the CLI. The basic components of the CLI are: Cts,metadata,cls and VES.
The CTS (Common type system, common type systems) is the basis of the CLI, a type specification that defines a collection of types that can be defined on all CLI platforms, all of which are based on a subset of the CTS, and now c++/ The CLI is the best high-level language to support the CTS descriptive narrative.
Metadata (metadata): used to describe and reference the type of the CTS definition, metadata is stored in a form independent of any language, and it is the metadata that gives the ability to build self-descriptive narratives.
The CLS (Common Language specification, Common Language Specification) is a set of rules to ensure interoperability of all CLI languages, which defines a minimum set of features (a subset of CTS) that all CLI languages must support. Each CLI language can choose its own mapping of part of the CTS, but to ensure the interaction of different languages, at least the minimum set of features defined by the CLS should be supported.
The VES (Virtual execution System), which provides CLI programs with a virtual machine environment that uploads and runs managed code on a variety of possible platforms, is just a specification, for example, Microsoft and Momo have their own implementations. The JIT and GC of the CLR for net should fall into this scope.
The. NET Framework is a Microsoft implementation of the CLI, and, of course, the best implementation of the present, the. NET Framework mainly includes the CLR and the BCL,CLR is the core of the implementation of the CLI, the BCL is a set of common code base, can be all. NET language (C #, vb.net, C + +/CLI) programs.
3) Seamless connection of isoc++ and CLI
C + +/CLI supports local isoc++ programming and. NET managed programming is seamlessly integrated, not simply mixed, not just like. NET calls Windows APIs to implement function Intermodulation through P/invoke, and can implement the mutual use of type class class and isoc++ and. NET class libraries, and, more strongly, can implement type blending. To achieve seamless connectivity, the vast majority of the once ISO C + + code is compiled with managed code, and some cannot be compiled into managed IL implementations using the P/invoke call. The code is managed, but the data is not managed and the data in the local heap in isoc++ is still in the local heap.
In summary, we are able to summarize that C + +/CLI is an extension of isoc++ in. NET, a seamless combination of isoc++ and. Net.
[C + +/CLI Programming Cookbook] [2] What is the C + +/CLI language