Search code examples
c#compiler-construction.net-assembly

Which code is MSIL? Is the code generated by ILDASM MSIL?


I am still confused with which code is called as MSIL.

Among other compilers, C# produces an assembly. ILASM also produces an assembly. Those assemblies contain MSIL?

How about the code generated by ILDASM when taking an assembly as its input? Is the generated code called MSIL?


Solution

  • MSIL is the "machine code like" language that the C# compiles your code into.

    The CLR is the "machine" that the MSIL runs on.

    When runinng the MSIL the CLR converts your code into real machine code using the JIT.

    The real machine code is run on your computers actual CPU.

    The MSIL Assembler (Ilasm.exe) generates a portable executable (PE) file from Microsoft intermediate language (MSIL). ILDASM is the disassembler to do the opposite.

    The PE format is used for EXE, DLL, SYS (device driver), and other file types.