diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-04-02 11:04:12 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-04-02 11:04:12 -0800 |
commit | 27ec33b1fa25ad2390215c435ba72bdc4090f3c9 (patch) | |
tree | ff3df98908d06f2248efae71c28574af9270ec4c /cpp/src | |
parent | bug 2944 - VC9 build failure in VB project helloIceBoxS (diff) | |
download | ice-27ec33b1fa25ad2390215c435ba72bdc4090f3c9.tar.bz2 ice-27ec33b1fa25ad2390215c435ba72bdc4090f3c9.tar.xz ice-27ec33b1fa25ad2390215c435ba72bdc4090f3c9.zip |
bug 2967 - DLLMain not correct
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/DLLMain.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/cpp/src/Ice/DLLMain.cpp b/cpp/src/Ice/DLLMain.cpp index 125e5f799dd..7c07fef0b9a 100644 --- a/cpp/src/Ice/DLLMain.cpp +++ b/cpp/src/Ice/DLLMain.cpp @@ -23,11 +23,18 @@ DllMain(HINSTANCE hDLL, DWORD reason, LPVOID reserved) #else ice_DLL_Main(HINSTANCE hDLL, DWORD reason, LPVOID reserved) { - if(!_CRT_INIT(hDLL, reason, reserved)) + // + // During ATTACH, we must call _CRT_INIT first. + // + if(reason == DLL_PROCESS_ATTACH || reason == DLL_THREAD_ATTACH) { - return FALSE; + if(!_CRT_INIT(hDLL, reason, reserved)) + { + return FALSE; + } } #endif + if(reason == DLL_PROCESS_ATTACH) { Ice::EventLoggerI::setModuleHandle(hDLL); @@ -38,6 +45,19 @@ ice_DLL_Main(HINSTANCE hDLL, DWORD reason, LPVOID reserved) Ice::ImplicitContextI::cleanupThread(); } +#ifndef __BCPLUSPLUS__ + // + // During DETACH, we must call _CRT_INIT last. + // + if(reason == DLL_PROCESS_DETACH || reason == DLL_THREAD_DETACH) + { + if(!_CRT_INIT(hDLL, reason, reserved)) + { + return FALSE; + } + } +#endif + return TRUE; } |