Sunday, September 11, 2011

Compilation to managed code

Compilation to managed code

The .NET Framework requires that you use a language compiler that is targeted at the CLR, such as the Visual Basic .NET, C#, C++ .NET, or JScript .NET compilers provided by Microsoft. Note that there are a lot of third-party compilers on the market (such as COBOL and Perl), and the number will continue to grow.

So how does the code that you typed into Visual Studio .NET become the code that the user receives when he is using your application? It is fairly simple and straightforward. Figure a diagram of the compilation process.


"managed-code-execution-process"

After using one of the language compilers, your code is compiled down to Microsoft Intermediate Language. Microsoft Intermediate Language, known as MSIL or simply IL, is a CPU-independent set of instructions that can be easily converted to native code. The metadata
is also contained within the IL.

The IL is CPU-independent. This means that IL code is not reliant on the specific computer that generated it. In other words, it can be moved from one computer to another (as long as the computer supports the .NET Framework) without any complications. This is what makes XCopy,
or just copying over the application, possible.

After IL, the code that you started with will be compiled down even further by the JIT
compiler
to machine code or native code. The IL contains everything that is needed to do this,
such as the instructions to load and call methods and a number of other operations.

No comments:

Post a Comment

Popular 5 Posts Last 7 days