Discussion Locked

What is MSIL

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What is MSIL (Microsoft Intermediate Language)

6 replies

by jay eckles

It's a part of .NET. When you compile any .NET language like VB.NET or C#. At runtime, the MSIL (Microsoft Intermediate Language) is jitted into machine code then executed. You can write a program in MSIL if you want, just like you could write a program in assembly if you want.

Jay
www.jayeckles.com

by jay eckles

I was re-reading my post and realized I left out part of the second sentence. It should read, "When you compile any .NET language like VB.NET or C#, the compiler translates the code into MSIL, not into machine code."

by ckmellin

MSIL Code is an intermediate set of instructions which can be generated using any of the Microsoft .NET tools. These incluse Visual Basic.NET, C#, and Visual C++.NET, Visual J++.NET. Also, many other vendors are now enabling their language/IDE's to complile MSIL code. For example you can create MSIL code for a COBOL program if the IDE supports it. When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be executed, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for eachcomputer architecture it supports, the same set of MSIL can be JIT-compiled and executed on any supported architecture. When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type's members, the members that your code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and Common Object File Format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or IDL.

This discussion is closed to new replies.