The common language runtime

Definitions and explanations about the common language runtime (CLR) in the .NET framework.

.NET Developer Tip
(Receive this column in your inbox,
click Edit your Profile to subscribe.)

The common language runtime
Peter G. Aitken and Phil Syme

If you haven't done any development for the .NET environment, chances are that you need to understand some basic terms about the concept. This tip, excerpted from InformIT, offers some definitions and explanations about the common language runtime (CLR) in the .NET framework.

The common language runtime (CLR) is the infrastructure that .NET uses to execute all your applications. The CLR includes a huge set of class libraries that you can use in your applications. Some interesting non-Internet–related classes include utilities that allow you to manipulate the Windows NT event log, Active Directory, cryptographic services, performance counters, COM+ services, object serialization, and Windows native services.

The CLR also takes care of compiling "intermediate language," or IL, code into native machine code. The basic process works as follows:

The Visual Basic compiler converts your code into IL. In terms of functionality and language complexity, IL is somewhere between assembly language and C. IL is optimized for quick compilation into machine code. Normally, you won't deal with IL in any of your development efforts. You can think of IL as an intermediate product of the compilation process.

Your Internet application is called by a user, or more precisely, by the Web server in response to a user's request.

The CLR takes over and compiles the IL into machine code. This happens function by function. If a function is used, it's compiled into machine code. If not, it remains as IL. The odds of an error occurring during this process are extremely small, equivalent to a compiler crash.

If this process seems roundabout and destined to make your application too slow, please suspend judgment until you've worked with .NET for a little while. You should be pleasantly surprised. At the minimum, this process makes development much faster, as the first step is much faster than other methods. You can also compile your .NET code directly into machine code by using standard tools installed with the .NET Framework.

The CLR contains other services, including support for running multiple .NET applications inside one process with a guarantee that they won't interfere with each other. This is a result of a concept called type safety. Any .NET language must guarantee type-safe code, which ensures that arrays and collections will never be accessed incorrectly, among other things. The Visual Basic compiler always enforces type safety when it compiles your code into IL.


For More Information:


This was first published in July 2002

Dig deeper on Microsoft .NET Web services






Forgot Password?


Your password has been sent to: