MSIL (or IL) – Microsoft Intermediate Language

MSIL or just “IL” is a byte code file format that programs written for the Microsoft .NET technologies are stored in.  Unlike native programs that contain actual machine code that the CPU can process directly, these programs have instructions that can’t be executed by any real world processor.  The purpose for this is so that the one binary file can be executed on multiple hardware and Operating System platforms without modification.

For example, say you’re writing a program that’s a simple text editor and you’re using the C# programming language.  This language is a .NET language and when you compile your source code with Microsoft Visual Studio, you’ll end up with a file whose name ends in “.EXE”.  You can double-click the file and you’ll see your newly written text editor run as any other normal Windows program.  But, unlike a normal Windows program, you can take that file and copy it directly to a Linux machine or a Macintosh and run it without modification (assuming the Mac and the Linux box have the Mono framework installed).

This is possible because the program is not compiled to native machine code and it doesn’t have operating specific instructions in it that would lock it into just one OS.  The .NET runtime on a Windows machine (as well as the Mono runtime on a Linux or Mac) will intercept the attempt to execute the EXE file and will instead interpret the byte code in it and convert it, just in time, to native machine code with hooks into the local operating system to make things “work” on that machine with that operating system.

IL is a language that looks an awful lot like Assembly Language.  And, in a way, it is, except the CPU that it’s written for doesn’t really exist.  It’s virtual.

Leave a Reply