   [C++] Problem with ICLRRuntimeHost
  Hello!Im trying to enable the CLR in a process. Thats the code im using:#include <Windows.h>#include <mscoree.h>#pragma comment(lib, "MSCorEE.lib")static ICLRRuntimeHost* gpClrHost = NULL;static LPTSTR gwszInjectorVersion = L"v1.0.0";enum MainRetCodes : DWORD{INJECT_SUCCESS= 0x00,INJECT_ERROR= 0x01,};BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved){switch(dwReason){case DLL_PROCESS_ATTACH:{HRESULT hRes = CorBindToRuntimeEx(NULL, L"wks", 0, CLSID_CLRRuntimeHost, IID_PPV_ARGS(&gpClrHost));if(FAILED(hRes) || gpClrHost == NULL)return FALSE;hRes = gpClrHost->Start();if(FAILED(hRes))return FALSE;TCHAR curDir[MAX_PATH];GetCurrentDirectory(MAX_PATH, curDir);wcscat_s<MAX_PATH>(curDir, L"\\InjectDLL.dll");DWORD dwRetVal = 0;hRes = gpClrHost->ExecuteInDefaultAppDomain(curDir,L"InjectDLL.Utils.EntryPoint", L"Run", gwszInjectorVersion, &dwRetVal);if(FAILED(hRes) || dwRetVal != INJECT_SUCCESS)return FALSE;return TRUE;}case DLL_PROCESS_DETACH:{if(gpClrHost == NULL)return TRUE;gpClrHost->Stop();gpClrHost->Release();return TRUE;}}return TRUE;}Now i have a problem with the Start-method. It seems to block. Sadly i cant find anything about that in the MSDN. Does anyone of you know why ICLRRuntimeHost::Start blocks and does not return?GreetingsPlerion   
  DllMain is most certainly not the location to do anything heavy like trying to host the CLR. Your process is likely to crash and burn horribly.A collection of links why, courtesy of Zao:Does creating a thread from DllMain deadlock or doesn't it?Another reason not to do anything scary in your DllMain: Inadvertent deadlockSome reasons not to do anything scary in your DllMainHow you might be loading a DLL during DLL_PROCESS_DETACH without even realizing itRead this too:DLL Best PracticesAnd this:Initialization of Mixed Assemblies;  Ok, that makes sense. It works when i create a thread with the initialization but according to the files that may just be luck. It does not work if i make a class which constructor performs the initialization and declare a global instance of that class in the DLL. So, what would be the best way if all i can do is call LoadLibrary and the rest goes out of my control?   