For C ++/CLI, we can divide its name into two parts. First, C ++, we are familiar with the currently widely used advanced language of the object-oriented ISO International Standard, also known as ISOC ++, which we will call ISOC ++ later. Second, CLI, we can consider it to be an extension of ISOC ++ on CLI. CLI is short for the general language framework, Microsoft's. net is the architecture on cli. Although CLI is now also ISO standard, C ++/CLI is not extended by the ISOC ++ committee, therefore, C ++/CLI is not a new version of the ISOC ++ standard. It is only implemented by Microsoft.. Net extension. Although C ++/CLI is not currently ISO standard, C ++/CLI integrates with ISOC ++ and. net has powerful capabilities, which is doomed to be ignored by us.
In fact, C ++/CLI not only includes ISOC ++ and CLI extensions, but also makes it powerful and more important because it implements seamless connections between ISOC ++ and. net. The following three aspects are detailed:
1) ISOC ++ Language
We know that C ++ is an ISO object-oriented language. For this language, we also refer to the following three aspects, it is also these three main aspects that determine his widespread use. First, C ++ is a powerful language. For example, the C ++ language itself provides nested types based on C language, arrays, struct and pointers, and C ++ is new to object-oriented class, inherited, there are also common data structures andAlgorithmSecond, a large number of open-source and third-party libraries. If C ++ is used for development on windows, we can use Microsoft to provide strong support for C ++, for example, vs compiler, UI library MFC, and ATL. In addition, we can also see many other non-Microsoft open source and third-party support, for example, boost greatly expands STL, provides more advanced functions, and Loki combines C ++ with the design mode. There are also many third-party UI libraries, for example, QT, wxwindows, wtl, GTK, and other third-party network communication libraries, such as Ace and streammodule, and third-party XML libraries, such as xerces, cmarkup, and tinyxml, third-party scientific computing libraries, such as blitz ++ and MTL, third-party game development libraries, such as ogre and klayge, and third-party thread libraries, such as C ++ threads and zthreads, there are many others; third, high performance of C ++. This feature of C ++ is also unquestionable. Most of the operating systems, embedded development, games, and image software we know are inseparable from C ++, this is closely related to the high performance of C ++. From this point of view, this is what many other modern advanced languages lack, that is why C ++ still has a long way to go.
2) CLI
CLI (Common Language infrastructure, universal language framework) provides a set of executableCodeAnd the specifications of the virtual execution environment required for running. More commonly, we can say that it is a virtual platform, operating system and application.ProgramA layer of abstraction between them. The basic CLR (Common Language Runtime) of Microsoft. NET is an instance of CLI. CLI consists of CTS, metadata, CLS, And ves.
CTS (common type system) is the basis of cli. It is a type specification that defines a set of types that can be defined on all CLI platforms, all CLI-based language types are a subset of CTS. Currently, C ++/CLI supports the best advanced language for CTs description.
Metadata: used to describe and reference the type defined by cts. Metadata is stored in a form independent of any language. It is exactly the metadata that gives the ability to build a self-description.
CLS (Common Language Specification) is a set of rules used to ensure the interoperability of all CLI languages, it defines a minimum feature set (a subset of CTS) that all CLI languages must support ). Each CLI language can select its own CTS ing to a part of the CTS, but to ensure interaction between different languages, at least the minimum function set defined by CLS should be supported.
Virtual Execution System (VES) provides a virtual machine environment for CLI programs to load and execute hosted code on various platforms. It is just a specification, for example, Microsoft and Momo have their own implementations .. Net clr jit and GC should belong to this range.
. Net Framework is an implementation of CLI by Microsoft, and of course it is also the best implementation at present ,. net Framework mainly includes Clr and BCL. CLR is the core, that is, the implementation of cli. Bcl is a set of common code libraries that can be used by all. net Language (C #, VB.. net, C ++/CLI) program.
3) seamless connection between ISOC ++ and CLI
C ++/CLI supports local ISOC ++ programming and. net managed programming seamless integration, not a simple mix, not only can be like. net calls windows APIs through P/invoke to implement mutual function calls, and can implement class-level and ISOC ++ and.. Net class libraries are used with each other, and more powerful is the Hybrid Implementation of types. To achieve seamless connection, most of the previously compiled Iso c ++ code will be managed code, and some cannot be compiled into managed il using P/invoke calls. Code hosting, but data is not hosted. Originally, the data in the local heap in ISOC ++ is still located in the local heap.
To sum up, we can conclude that C ++/CLI is an extension of ISOC ++ in. net, and is a seamless combination of ISOC ++ and. net.