Saturday, August 2, 2008

. NET Framework's Common Language Runtime

. NET Framework's Common Language Runtime Runtime

CLR?

Mentioned in the previous operation. NET Framework in the code called managed code, contrary called unmanaged code. Compared to unmanaged code, managed code has a lot of advantages, for example, can be used to prepare a variety of programming languages, increase security, version control and procedures easy release, and so on. These are provided by the CLR. But there are also some negative points, the code is easy to think of the speed problem.

To provide for the function of managed code, the code must know CLR data types, classes and she connected with the definition of assembly. This information is called metadata, and metadata contained in the code of a certain part (compiled). CLR use of the metadata loading code segment, memory management, and methods of implementation, such as call operation.

. NET out before, in different programming languages shared between the original code, it is impossible. Every programming language because the definition of different data types, and different syntax. Microsoft masters thought of the data types a good way to reunification. The technology called CTS (common type system). Development projects are now on the relatively simple (in different languages), for example, a project team will use VB, there are and will be using C + +. Previously possible way is to call between the two functions written or COM DLL. But now no such trouble, and you can direct the use of other languages of the code. Specifically, using VB.NET can inherit C + +. NET writing category, in turn, is possible.

We install the software often encountered when such tips - components in the system than to install the new components, you should be retained or replaced? It is so disgusting? ! Now you start with. NET bar, she would not because of this "small" problem and disturb you. Because every code contains the metadata associated with her, and CLR will be the basis of this information to manage different versions of the code. And because the code information not registered to the registry, you can use the X-COPY installed code (as simple as pasting a copy).

Using VB is doing a good job? Still do a good job with C + +? The problem is that we do these projects often time to consider the issue. But. NET programming language with what has become a less important (but still have some differences in specific projects), as provided CLR CTS (and base class library), and above all running on the CLR. In. NET VB, C + + and other languages are quite a lot of increase, and a new language C #. C # application of the standard and has been passed, we can imagine the POWE her. We all know that borland also issued a related development tools C # builder.

Be a Summary

N. NET code contains its own relevant information called metadata.

N CLR provide CTS (CLS also credits), in different programming languages can be shared between the original code.

N using metadata management code information (instead of using the registry), the code is easy to install.

N use a unified data type and class libraries, it becomes the choice of programming language is not important, and easy to team development.

CLR code in the operation process

N compiler options

First choice CLR compiler, as CLR can run in different languages developed code.

N the code compiled into MSIL

Choice of using CLR compiler generated MSIL (Microsoft intermediate language) and metadata to their load to PE (portable executable file).

MSIL: Interpretation language, the code contains information to enable easy JIT compiler into machine language. And unrelated to the operating system and programming language.

PE: executable file format, windows is a DLL or EXE.

N with JIT compiler to MSIL compiled into machine language

There are two ways a compiler is the only current implementation of the code segment, and the other is a one-time code to the compiler. JIT will test the safety of the code.

N code execution

Calling will be the first time the code into machine code compiler, again when it is no longer called re-compiled.

Related tools

- MSIL generator - MSIL Assembler (ilasm.exe)

- MSIL anti-Compiler - MSIL Assembler (ildasm.exe)

Use Act

Http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpconmsilassemblerilasmexe.asp

Related information

- PE structure

No comments: