The intermediate code that is generated when a program
targeted at the JVM or CLR is compiled is the key to portability for both Java
and Microsoft .NET technologies. The basic representation of the intermediate
code that is generated on compilation of any program targeted at the runtime
environment of .NET comprises of the MSIL instructions and its Metadata that contains
the Manifest, which in turn describes the MSIL code. Any program that targets
the .NET runtime environment when compiled generates MSIL code which is passed
as input to the JIT compiler that translates the same to native code. The MSIL
code that is generated is stored in a Portable Executable file that is
essentially based on the standard Microsoft Windows Portable Executable (PE)
and the Common Object File Format (COFF).
The basic objective of this article to give the reader a
bird's eye view of MSIL, PE file structure, the CLR header and how the managed
environment of Microsoft.NET works. Before we delve deep into the internals of
MSIL, we have to have a basic understanding of some related concepts and
terminologies like CLR, CLS, CTS, JIT, Class Loader, etc. These are the short
forms of the respective terminologies and we will explore each of them as we
progress further. Each of these is discussed in the sections that follow prior
to the discussion on MSIL, PE and COFF as these are the prerequisites for
having a proper understanding of MSIL.