Starting the CLR


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));



    Customizing the Microsoft  .NET Framework Common Language Runtime
    Customizing the Microsoft .NET Framework Common Language Runtime
    ISBN: 735619883
    EAN: N/A
    Year: 2005
    Pages: 119

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net