Customizing the Microsoft .NET Framework Common Language Runtime
|
Calling CorBindToRuntimeEx sets the CLR startup options and loads the core runtime engine DLL (mscorwks.dll) into the process. However, the runtime must still be "started" before any managed code can be run. Once initialized, starting the CLR is easy. Just call the Start method on the ICLRRuntimeHost pointer you got back from calling CorBindToRuntimeEx as shown in the following example. // Set the CLR startup options HRESULT hr = CorBindToRuntimeEx( L"v2.0.41013", L"svr", NULL, CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, (PVOID*) &pCLR); // Use ICLRRuntimeHost to start the CLR hr = pCLR->Start(); assert(SUCCEEDED(hr)); |
|