Showing posts with label Steps How CLR executes a DLL file. Show all posts
Showing posts with label Steps How CLR executes a DLL file. Show all posts

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.

Steps How CLR executes a DLL file

How CLR executes a DLL file.

1. CLR will be loaded into memory

2. CLR loads a Manifest

3. CLR loads Type Info.

4. CLR generates CTS of CLS (System.Int16, System.Int32, 64)

5. CTS information will be loaded into MSIL

6. CLR generates output.

Always CLR tracks for the changes in the program. If program is modified step 1- 6 will be executed, otherwise only step 6th will be executed. Due to this behavior CLR is called as Just In Time Compiler.

Popular 5 Posts Last 7 days