What is CLR – Common Langauge Runtime?

Common Language Runtime/CLR

What is CLR. The CLR stands for Common Langauge Runtime. This is the foundation of the .Net Framework. It acts as an execution engine of the .Net Framework and manages the execution of programs and provides a suitable environment.

As the name of CLR explains itself, the common language runtime provides a multi-language execution environment. The special thing about CLR is that it makes .net platform-independent. There are several programming languages that support the .Net framework that you can use to program .net applications. If you know C++ and want to code in C++ you can do that in .net framework due to CLR. Please look at the diagram that I have created for your guys to understand the process.

The CLR Diagram

CLR

The Diagram Explanation

As you can see in the diagram, there are several stages your code goes through before it reaches the processor. Once you write the code it goes to a compiler first to check if all the syntaxes are correct and there is no logical error in the code. The .Net framework has the compiler for every programming language that it supports. In the second stage, the code gets converted into CIL (Common Intermediate Langauge) code.

The Common Intermediate Langauge has another name and that is Microsoft Intermediate Language.

The people who have a bit knowledge of Java programming language, they know Java has JVM that provides suitable execution for the programs. CLR is the works like JVM works in Java.

Once the code is converted to the CIL code, it goes to the next compiler called JIT compiler (Just In Time) Compiler. The just in time compiler takes the entire code and understands which part of the code should be converted into binary code and get fed to the processor.

The just in time compiler is smart enough to understand that not the whole code should be converted into binary because the user is just using a few functions of the application.

Now you can see the code which is going to the processor is binary code and the code that the programmer wrote is completely different. The programmer has the choice to write the code in his or her preferred language in the .net framework. This is all possible because of CLR.

I hope the concept of the CLR is clear to you. In case you have any questions please feel free to comment.

Take care Guys!

Share your love
Nadeem
Nadeem

Leave a Reply

Your email address will not be published. Required fields are marked *