When you compile code that uses the .NET Framework library, you don ’ t immediately create operating system – specific native code. Instead, you compile your code into Microsoft Intermediate Language (MSIL) code. This code isn ’ t specific to any operating system and isn ’ t specific to C#. Other .NET languages — Visual Basic .NET, for example — also compile to this language as a first stage. This compilation step is carried out by VS or VCE when you develop C# applications.
Obviously, more work is necessary to execute an application. That is the job of a Just – in – Time (JIT) compiler, which compiles MSIL into native code that is specific to the OS and machine architecture being targeted. Only at this point can the OS execute the application. The just – in – time part of the name reflects the fact that MSIL code is only compiled as, and when, it is needed.
In the past, it was often necessary to compile your code into several applications, each of which targeted a specific operating system and CPU architecture. Often, this was a form of optimization (to get code to run faster on an AMD chipset, for example), but at times it was critical (for applications to work in both Win9 x and WinNT/2000 environments, for example). This is now unnecessary, because JIT compilers (as their name suggests) use MSIL code, which is independent of the machine, operating system, and CPU. Several JIT compilers exist, each targeting a different architecture, and the appropriate one will be used to create the native code required.
The beauty of all this is that it requires a lot less work on your part — in fact, you can forget about system – dependent details and concentrate on the more interesting functionality of your code.


You may also like...