Common language runtime

from Wikipedia, the free encyclopedia

The Common Language Runtime shortly CLR , is the name of the virtual runtime environment of .NET - applications . The CLR thus represents a concrete implementation of the runtime environment of the common language infrastructure for the .NET framework. The CLR does not directly execute the program code of a high-level programming language, but interprets Common Intermediate Language code (ECMA designation, formerly Microsoft Intermediate Language). For this, the program code of a .NET language (C #, J #, F #, C ++ / CIL…) is translated into CIL code using a language-dependent compiler. Among other things, this has the advantage that parts of a program can be written in different programming languages.

Explanation and functionality

Simplified functional principle of the common language runtime in the .NET Framework

If a program is translated from a .NET programming language, assemblies (file extensions .exe or .dll ) are first generated which contain the translated CIL code as well as various headers and metadata. This step must be carried out by a language-specific compiler . CIL code is an intermediate code that is managed by the CLR and is therefore also referred to as managed code , as a differentiated from unmanaged code or native code . During the runtime of the program, the loaded assemblies are translated into native code (machine code) by a just-in-time compiler , which is part of the CLR, which can be executed by the CPU .

The services offered by the CLR can be used by the programming languages ​​in which the respective application was programmed. These services include garbage collection , exception handling and ensuring code access security . The CLR relies on the Common Type System , which is a collection of types and functions that are supported in many programming languages.

The CLR is the implementation of the Virtual Execution System component , which belongs to the Common Language Infrastructure standard , for the .NET Framework .

Adaptations

There are other runtime environments that adapt the CLR and also use this name:

  • Mono contains a runtime environment based on the model of the .NET Framework; it is sometimes also referred to as CLR.
  • CoreCLR is the name of the runtime environment used in the modular, open source framework .NET Core .
  • .NET Native includes a runtime environment, which is also called CLR. It is used when running Universal Windows Platform Apps for Windows 10 . These applications are not in CIL code supplied , but directly into native code. Just-in-time compilation is no longer necessary.

literature

Individual evidence

  1. Mohammad Rahman: C # Deconstructed: Discover how C # works on the .NET Framework , Apress 2014, ISBN 978-1-4302-6670-9 , p. 16
  2. ^ Neil McAllister: Microsoft takes lid off .Net Common Language Runtime sauce , in: The Register of February 3, 2015, accessed on Dec. 9, 2015
  3. Holger Schwichtenberg: Two in one stroke , in: Windows Developer No. 10/2015, p. 8 ff. ( Online edition , October 12, 2015, last accessed on December 16, 2016)