What is CLR in Microsoft.net Framework?

by naval| Views: 1047

What is Common Language Runtime?
How common language runtime in .Net framework is different than JVM?
What services CLR provides to Microsoft.Net Managed Applications?

Answers (1)
 
kevin Said..

The CLR (Common Language Runtime) is the execution engine for the .NET Framework. This runtime manages all code compiled with C#, VB.NET. In fact, code compiled to run under .NET is called managed code to distinguish it from code running outside of the framework.

Besides being responsible for application loading and execution, the CLR provides services that will benefit component developers:

• Invocation and termination of threads and processes
• Object lifetime and memory management
• Cross-language integration
• Code access and role-based security
• Exception handling (even across languages)
• Deployment and versioning
• Interoperation between managed and unmanaged code
• Debugging and profiling support (even across languages)

Runtimes are nothing new. Visual Basic has always had some form of a runtime. Visual C++ has a runtime called MSVCRT.DLL. Perl, Python, and SmallTalk also use runtimes. The difference between these runtimes and the CLR is that the CLR is designed to work with multiple programming languages. Every language whose compiler targets the .NET Framework benefits from the services of the CLR as much as any other language.

.NET is also similar to Java. Java uses a runtime called the Java Virtual Machine. It can run only with Java code, so it has the same limitations as the other languages mentioned previously. Another distinction is that the JVM is an interpreter.

Although all languages in the .NET environment are initially compiled to a CPU-independent language called Intermediate Language (MSIL, IL) (which is analogous to Java byte code), IL is not interpreted at runtime like Java. When code is initially executed, one of several just-in-time (JIT) compilers translate the IL to native code on a method-by-method basis.

Cross-language integration is one of the major benefits provided by the CLR. If a colleague
has written a base class in C#, you can define a class in VB.NET that derives from it. This is known as cross-language inheritance. Also, objects written in different languages can easily interoperate. The two parts of the CLR that make this interoperation possible are the Common Type System and the Common Language Specification.



Register or Login to Post Your Opinion/Answer