============================================================================================================================================================================================================= ==============
FAQ - What is the .NET program done when compiling and running?
============================================================================================================================================================================================================= ==============
There is a large number of design compilations about a .NET program in the newsgroup and mailing list (Design-Time OR)
Run-time) and questions from the CPU-Specific Binary or Pseudo-Code.
Here is a simple answer: when you compile a C # application or any CLS (CommMon
When the language specification is compatible, it will first be compiled into one called IL.
Pseudo-code of Intermediate Language. In this application first time
This IL code will be compiled into machine code for execution. That is to say, from the source code
To get the results, compiled twice. In fact, only those functional code being truly used
It will be compiled for the second time. The details that are hidden during the development process are revealed:
1) You use C # to develop some programs
2) Compile into EXE with C # compiler or CLS compatible compiler
3) The compiler will generate the IL code and additional information (Manifest) to the Win32 with a standard Pe header
The only part of the executable file.
4) The compiler is imported (import) a function called _corexemain when you create this executable.
This function is the entry function of the .NET EE (Execution Engine) -. Net runtime engine.
5) When performing this Win32 executable, because it mainly relies on the DLL PE file, the operating system
Unit will call the _corexemain function located in Mscoree.dll.
6) The operating system calls Mscoree.dll through the entry point in the PE file. And guarantee in Windows
There are many programs to run simultaneously.
7) Because the operating system cannot perform .NET IL code, the entry point in EXE is just a simple intermediary, it will
Indicates the operating system call _corexemain function.
8) Then the _corexemain function begins to explain the IL code located in the PE file.
9) Because IL cannot be executed directly, .NET EE is called Jitter (Just In Time Compiler)
The instant compiler compiles the IL code cost CPU machine code for execution. This instant compilation process
Only during the first execution.