The .NET CLR is not an interpreter, since code gets compiled to native code by the JIT compiler. So I find the usual description of code "running on" the CLR confusing.

How does the native code interact with the CLR? Does the compiler insert calls into CLR methods at the beginning and end of your methods, for example?

I have no idea.

  • 6
    The R stands for Runtime. It is a Virtual Machine that executes .NET code. en.wikipedia.org/wiki/Common_Language_Runtime
    – Oded
    Jun 24, 2014 at 16:22
  • 2
    Learn about the difference between managed and unmanaged code, and it'll probably click for you.
    – Calphool
    Jun 24, 2014 at 21:26

1 Answer 1


There's a decent overview of the .NET Common Language Runtime on MSDN. There are a few key paragraphs that may get you started understanding the process:

The common language runtime provides the infrastructure that enables managed execution to take place and services that can be used during execution. Before a method can be run, it must be compiled to processor-specific code. Each method for which MSIL has been generated is JIT-compiled when it is called for the first time, and then run. The next time the method is run, the existing JIT-compiled native code is run. The process of JIT-compiling and then running the code is repeated until execution is complete.

During execution, managed code receives services such as garbage collection, security, interoperability with unmanaged code, cross-language debugging support, and enhanced deployment and versioning support.

In Microsoft Windows XP and Windows Vista, the operating system loader checks for managed modules by examining a bit in the COFF header. The bit being set denotes a managed module. If the loader detects managed modules, it loads mscoree.dll, and _CorValidateImage and _CorImageUnloading notify the loader when the managed module images are loaded and unloaded. _CorValidateImage performs the following actions:

  1. Ensures that the code is valid managed code.

  2. Changes the entry point in the image to an entry point in the runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.