liveBook · Manning

Intermediate language

As explained in .NET in Action, Second Edition

An intermediate language is a processor-independent compiled representation that can later be translated into machine code.

Intermediate language (CIL) is a processor-independent compiled representation used by .NET. Language-specific compilers translate code into CIL, which can be packaged in a DLL and run on different operating systems and processor architectures wherever a .NET runtime is available. CIL resembles assembly but uses instructions at a higher level of abstraction. section 1.1 section 1.5.1

The execution path separates language compilation from processor-specific code generation:

  • A compiler translates a language such as C# into CIL. section 1.1
  • The runtime typically uses just-in-time (JIT) compilation to translate CIL into machine code as needed. section 1.5.1 section 1.5.2
Figure 1.4 .NET languages compile to CIL in a DLL file that can be run on any machine with a .NET runtime.

The diagram shows language compilers producing CIL in a DLL, then a .NET runtime converting it to machine code. section 1.5.1

How .NET in Action, Second Edition covers it

How deep it goes
Defines CIL and traces its translation through DLL packaging to runtime code generation, without teaching CIL instructions.
Examples
Uses a diagram of language compilers producing a CIL DLL for execution by a .NET runtime.
What you can do after
Understand how CIL separates language compilation from processor-specific machine-code generation.
How it connects
Connects CIL to language compilers, DLLs, the .NET runtime, and just-in-time compilation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET in Action, Second Edition. The section links point to the parts of the book it draws on.