I'm just trying to better understand what happens in a simple scenario when the following code is added to a file and saved with the .cs extension:
public class HelloWorld { public static void Main() { System.Console.WriteLine("Hello World!"); System.Console.ReadLine(); } }
and then this program runs on a Windows command prompt with:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>csc /t:exe /out:C:\HelloWorld\HelloWorld.exe C:\HelloWorld\HelloWorld.cs
I see that this process creates a .exe file, however, when you read about compiling the process in wikipedia , it reports:
- The source code is converted to the Common Intermediate Language (CIL), which is the CLI equivalent of the assembly language for the CPU.
- Then CIL is assembled in the form of so-called bytecode and a CLI assembly is created.
- After the CLI assembly completes, its code is passed through the JIT compiler at runtime to generate its own code ...
- Native code is executed by a computer processor.
And the .exe file itself consists only of Common Intermediate Lanaguage? And is this file what the wikipedia article calls the "CLI build"? I am a little confused because I can only see the .exe file, and for me the term “build” contains more than one file.
And the related question:
- is the JIT compiler somewhere in the Microsoft.NET directory, and after executing the .exe file, does the file interact with the JIT compiler, which then outputs the instructions to native code?
source share