Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Common Language Runtime (CLR) is a managed execution environment that is part of Microsoft’s .NET framework. CLR manages the execution of programs written in different supported languages.
CLR transforms source code into a form of bytecode known as Common Intermediate Language (CIL). At run time, CLR handles the execution of the CIL code.
Developers write code in a supported .NET language, such as C# or VB.Net. The .NET compiler then converts it into CIL code. During run time, the CLR converts the CIL code into something that can be understood by the operating system. Alternately, the CIL code can be transformed into native code by using the native image generator (NGEN).
The language compilers store metadata that describes the members, types and references in the compiled code. The CLR uses the metadata to lay out instances in memory, locate and load classes, enforce security, set runtime context boundaries, and generate native code.
CLR allows for the easy use of different supported languages to achieve a common goal. This makes it flexible for developers to choose their own programming language, provided it is supported by the .NET framework. With CLR, .NET can manage the execution of all supported languages by transforming them to bytecode and then into the native code for the chosen platform.
Using NGEN makes later runs faster because CLR will not have to transform the bytecode into native code each time. Although other implementations of CLI can run on platforms other than Windows, Microsoft’s CLI implementation is only meant to run on the Windows platform.