1. Summary
This article introduces the Cross-Language capabilities of CLR environment (Common Language Runtime Environment) and its constituent language IL (Intermediate Language).
2. Introduction
Microsoft .NET framework brings one of the amazing aspects of development, called "Cross-Language Development". By Cross-Language development it means, cross language Inheritance, Cross-Language Debugging and Cross-Language Exception handling. More generally, we can visualize Cross-Language development as follows. The code written using C# (as a matter of fact any .NET compliant language) should be usable in another language such as VB. Later on these two code modules should be usable in, yet another language like JScript etc and so on. In order to make the above said statement possible there should be a common run time environment, which can understand all these languages.
This article introduces the Cross-Language capabilities of CLR (Common Language Runtime Environment) and describes how IL (Intermediate Language) becomes core of all .NET compliant languages. In particular, I discuss about how to program using Intermediate Language and Use ILASM (IL assembler). Further, I also deal with some examples, which demonstrate the cross language capabilities of .NET framework. In the examples that follow i will be using IL (Intermediate Language), C#, Jscript, C++ and VB languages.
One of the main design goals of .NET is to encourage cross - Language development. (Cross - Language Inheritance, Exception handling etc.) The advantage of doing so is, a developer can choose a language that best suits for delivering a given module / unit (each language has its own strengths) and still be able to integrate into a single application. The end result of that is Languages become equal. Even employers also feel more comfortable as they would have more resource and options at hand.
Microsoft .NET framework also eliminates DLL hell and allows for side by side deployment of Components. This is so because registration information and state data are no longer stored in the registry where it can be difficult to establish and maintain.
In the section that follows, i will introduce the .NET framework architecture in brief and then move to different cross language implementation using different .NET compliant languages.
3. Microsoft .NET Architecture
IL - Intermediate Language
CLR Environment - Common Language runtime Environment
JIT - Just in time Compilation
VES - Virtual Execution System
BCL - Base Class Library
PE Portable Executable
GC Garbage Collector
Common Language Runtime
Common Language Runtime (CLR) manages the execution of code and provides different services like Garbage collection and support for Base Class Libraries etc. The main constituents of CLR are described below
The common Language Runtime (CLR) a rich set of features for cross-language development and deployment. CLR supports both Object Oriented Languages as well as procedural languages. CLR provides security, garbage collection, cross language exception handling, cross language inheritance and so on.
The Common Type System, support both Object Oriented Programming languages as well as procedural languages. Basically CTS provides rich type system that is intended to support wide range of languages.
CLS (Common Language Specification) defines a subset of Common Type System, which all language compilers targeting CLR must adhere to. CLS is a subset of CTS.
All compilers under .NET will generate Intermediate Language no matter what language is used to develop an application. In fact, CLR will not be aware of the language used to develop an application. All language compilers will generate a uniform, common language called Intermediate Language. For this reason IL can be called as The language of CLR A platform for cross language development.
Just in Time Compiler converts the IL code back to a platform/device specific code. In .NET you have three types of JIT compilers.
Pre-JIT (Compiles entire code into native code at one stretch)
Ecno-JIT (Compiles code part by part freeing when required)
Normal JIT (Compiles only that part of code when called and places in cache)
Type safety is ensured in this phase. In all, the role of a JIT compiler is to bring higher performance by placing the once compiled code in cache, so that when a next call is made to the same method/procedure it get executed at faster speed.
Virtual Execution System (VES) implements Common Type System. VES loads links and runs Portable Executable (PE) files. VES also ensures to load the information contained in metadata.
Metadata

krishan vermaeditedPosted Jan 27, 2011, 12:11 AMEdited Jan 27, 2011, 12:12 AM
hi sir please tell me clearly about CLS (Common Language Specification).