CLR (COM server)
The CLR is implemented as a COM server in the MSCorWks.dll file. When the. NET framework is installed, the COM server that represents the CLR is registered in the Windows registry.
MSCorEE.dll (GASKET)
MSCorEE.dll's job is to determine what version of the CLR was created. The unmanaged application host invokes the CorBindToRuntimeEx function in MSCorEE.dll (shim) or another similar function to create an instance of CLR Com.
A machine can install multiple versions of the CLR, but only one version of the MSCorEE.dll file in the machine.
The relationship between the above two is shown in the following code (c + +): MSCorEE.dll (GASKET)---->CLR (COM server)
Code highlighting produced by Actipro
Codehighlighter (freeware) http://www. codehighlighter.com/--> #include <Windows.h>
#include <MSCorEE.h>
#include <stdio.h>
#pragma comment (lib, "Mscoree.lib")
int main (int argc, char* argv[])
{
iclrruntimehost *pclrhost;
The CorBindToRuntimeEx () in call <MSCorEE.h> generates the COM server
HRESULT hr= CorBindToRuntimeEx (null, NULL, NULL, CLSID_ Clrruntimehost, Iid_iclrruntimehost,
(lpvoid*) &pclrhost);
Start CLR
pclrhost->start ();
//............................ Other operations
//termination of CLR
pclrhost->stop ();
GetChar ();
return 0;
}
application domain (AppDomain)
An application domain is a container for a set of assemblies. The entire purpose of an application domain is to provide isolation.
The image above is a separate Windows process running a CLR COM server. Each application domain in the CLR has its own loader heap. (System domain, shared domain, Default domain #, other domain)
Some special assemblies such as MSCorLib.dll, which need to be shared by all application domains, are loaded in a way that is neutral to the application domain, and the CLR maintains a special loader heap.