Microsoft Intermediate Language


As you can see in Figure 24.1, all .NET code, regardless of the language syntax used, compiles to Intermediate Language (IL) code. IL code is the only code the Common Language Runtime understands; it doesn't understand Visual C#, Visual Basic, or any other developer syntax. IL gives .NET its multilanguage capabilities; as long as an original source language can be compiled to IL, it can become a .NET program. For example, people have developed a .NET compiler for COBOLa mainframe language with a long history. This compiler takes existing COBOL code and compiles it to IL so that it will run within the .NET Framework using the Common Language Runtime. COBOL itself isn't a Windows language and doesn't support many of the features found in a true Windows language (such as a Windows Forms engine), so you can imagine the excitement of COBOL programmers when they first learned of being able to leverage their existing code and programming skills to create powerful Windows applications.

Figure 24.1. These are the steps taken to turn developer code into a running component.


By the Way

A potential drawback of IL is that it can be susceptible to reverse compilation. This has many people questioning the security of .NET code and the security of the .NET Framework in general. If code security is a serious concern for you, I encourage you to research this matter on your own.


IL code isn't the final step in the process of compiling and running an application. For a processor (CPU) to execute programmed instructions, those instructions must be in machine language format. When you run a .NET application, a just-in-time compiler (called a JITter) compiles the IL to machine-language instructions that the processor can understand. IL code is processor independent, which again brings up the possibility that JITters could be built to create machine code for computers that are using something other than Intel-compatible processors. If Microsoft were to offer a common language runtime for operating systems other than Windows, many of the differences would lie in the way IL would be compiled by the JITter.

As .NET evolves, changes made to the common language runtime will benefit all .NET applications. For example, if Microsoft finds a way to further increase the speed at which forms are drawn to the screen by making improvements to the Common Language Runtime, all .NET applications will immediately benefit from the improvement. However, optimizations made to a specific syntax compiler, such as the one that compiles Visual C# code to IL, are language specific. This means that even though all .NET languages compile to IL code and use the common language runtime, it's possible for one language to have small advantages over another because of the way in which the language's code is compiled to IL.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net