Equivalent of Class Loaders in .NET

The answer is yes, but the solution is a little tricky. The System.Reflection.Emit namespace defines types that allows assemblies to be generated dynamically. They also allow the generated assemblies to be defined incrementally. In other words it is possible to add types to the dynamic assembly, execute the generated code, and then latter add more … Read more

How does CorFlags.exe /32BIT+ work?

This isn’t well documented in any place I know of, I can only point you to a relevant MSDN article. Yes, your assumption is correct, the loader in Windows XP and up has awareness of managed executables. It automatically loads the .NET loader shim (c:\windows\system32\mscoree.dll), the relevant entrypoint is _CorValidateImage(). The Remarks section in the … Read more

Why only literal strings saved in the intern pool by default?

The short answer: interning literal strings is cheap at runtime and saves memory. Interning non-literal strings is expensive at runtime and therefore saves a tiny amount of memory in exchange for making the common cases much slower. The cost of the interning-strings-at-runtime “optimization” does not pay for the benefit, and is therefore not actually an … Read more

Is the CLR a virtual machine?

There are a lot of misconceptions here. I suppose you could think of .Net as a virtual machine if you really wanted, but let’s look at how the .Net Framework really handles your code. The typical scenario looks like this You write a .Net program in C#, VB.Net, F#, or some other compatible language. That … Read more

How are DLLs loaded by the CLR?

The following copied from Don Box’s excellent Essential .Net. (available here) (and, imho, a must have for any professional .Net developer) The CLR Loader The CLR Loader is responsible for loading and initializing assemblies, modules, resources, and types. The CLR loader loads and initializes as little as it can get away with. Unlike the Win32 … Read more