From: http://blog.csdn.net/Eric_Jo/archive/2009/05/14/4184916.aspx
To understand what C ++/CLI is, first know what CLI is.
1. Introduction to 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, 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, general language specification): 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 (Real-time universal language) is the core, that is, CLI implementation. Bcl is a set of common code libraries that can be used by all. net Language (C #, VB.. net, C ++/CLI) program. Visual c ++ 2005 is the implementation of C ++/CLI.
2. What is C ++/CLI?
In fact, in addition to ISOC ++ and CLI extensions, C ++/CLI is more powerful because it implements seamless connections between ISOC ++ and. net. 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.
C ++/CLI (CLI: Common Language infrastructure) is a new language specification used to replace C ++ managed extensions (referred to in Mc ++ below. It simplifies the C ++ hosting extension syntax and provides better code readability. Like other Microsoft. NET languages, Microsoft submitted C ++/CLI standards to ECMA. C ++/CLI can now be developed on Visual C ++ 2005. Some features of C ++/CLI have been patented.
3. What does C ++/CLI provide to us?
① Elegant and fluent syntax and grammar-C ++/CLI provides a natural feeling for C ++ developers to write managed code, in addition, it provides a smooth transition from unmanaged code to managed code. In the past, the so-called "double bottom line" problem has vanished.
② First-class CLI support-cli features, such as attributes, fragment sets, and family classes are directly supported. In addition, C ++/CLI allows these features to be used for locally hosted classes.
③ Class C ++ supports Class C ++ features. For example, templates and destructor are still valid for drag-and-drop pipes and non-drag-and-drop pipes. In fact, C ++/CLI is A. NET language that you can declare on the stack or C ++ local stack.
④ A bridge was built on the gap between. NET and C ++-C ++ developers no longer leave the water when attacking BCL.
⑤ The executable files generated by the C ++/CLI compiler are completely verifiable.
4. What can we do with C ++/CLI?
It can be explained simply from the three parts it contains:
① ISOC ++ is the basis for C ++/CLI to expand the CLI. c ++/CLI fully retains and is fully compatible with the previous ISOC ++ section, therefore, what ISOC ++ can do is that C ++/CLI can continue. Some people say this is ISOC ++, so I will also tell you that it is C ++/CLI, because it is compiled into il code, we can use it to develop games and graphics processing software. However, if you want to develop a system or the underlying layer, You need to compile the code into local code, in fact, C ++/CLI is ISOC ++;
② For cli. Net implementation extension, we can fully use the advantages brought by. net, such as a large class library and efficient UI rapid development capabilities;
③ ISOC ++ and. net integration, through this part, better supplement the previous local code and. the ability to interact with the net code reduces the difficulty of integration and makes full use of the advantages of various languages and developers.
5. basics required to learn C ++/CLI
C ++/CLI contains ISOC ++ and its.. Net extension. One is ISOC ++, and the other is in.. Net extension, it can be seen that the Foundation is ISOC ++, which is also the foundation I have pointed out here.
Although C ++/CLI includes ISOC ++ and Its Extensions, considering that ISOC ++ is a large part of content and there are already a large number of books, therefore, this series focuses on ISOC ++ pairs.. Net extension.
C ++/CLI: the dynamic component object programming model from static C ++ object model to CLI.. Net extensions are ISOC ++ and.. net. In short, it is how you program in. Net with C ++, rather than C # Or Visual Basic. net.
this article from the csdn blog, reprinted please indicate the source: http://blog.csdn.net/Eric_Jo/archive/2009/05/14/4184916.aspx