static void InitManagedModule() { #if (_MSC_VER < 1400) //pre MSVC 8.0 // Microsoft Knowledge Base 814472 __crt_dll_initialize(); #endif //Init the entity plugin directly since we link statically to it GetEnginePlugin_NodeEnginePlugin()->InitEnginePlugin(); }
BOOL ManagedWrapper::minitialize (void) { BOOL retval = TRUE; try { retval = __crt_dll_initialize(); } catch(System::Exception* e) { Console::WriteLine(e->Message); retval = FALSE; } return retval; }
extern "C" AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt) { switch(msg) { // onload of arx case AcRx::kInitAppMsg: { acrxDynamicLinker->registerAppMDIAware(pkt); // we add code that will use global variables or native classes with // static data members (for example, the ATL, MFC, and CRT libraries use global variables) // once we do this we will receive linker error messages at compile time. // To get round this problem, we must add code to manually initialize the static variables // see http://support.microsoft.com/?id=814472 for more details __crt_dll_initialize(); // create a new object factory array static AcMgObjectFactoryBase* PEs[] = { new AcMgObjectFactory<Autodesk::ObjectDbxSample::Poly,AsdkPoly>(), // end the array with a NULL NULL }; g_PEs = PEs; }break; case AcRx::kPreQuitMsg: { // clean up int i=0; while (g_PEs[i]!=NULL) delete g_PEs[i++]; // use atexit. // see http://support.microsoft.com/?id=814472 __crt_dll_terminate(); }break; } return AcRx::kRetOK; }
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) { ul_reason_for_call; #ifdef NEEDS_CRT_INIT if (ul_reason_for_call == DLL_PROCESS_ATTACH || ul_reason_for_call == DLL_THREAD_ATTACH) { __security_init_cookie(); __crt_dll_initialize(); } #endif currentInstance = static_cast<HINSTANCE>(hModule); return true; }