Mercurial > hg > orthanc
comparison OrthancFramework/SharedLibrary/DllMain.cpp @ 5277:acaea72a3e91 Orthanc-1.12.0
Orthanc-1.12.0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Apr 2023 17:31:27 +0200 |
parents | 0ea402b4d901 |
children | 48b8dae6dc77 |
comparison
equal
deleted
inserted
replaced
5276:d00064ec4baf | 5277:acaea72a3e91 |
---|---|
25 | 25 |
26 This file merges 2 files: | 26 This file merges 2 files: |
27 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp | 27 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp |
28 ${OPENSSL_SOURCES_DIR}/crypto/dllmain.c | 28 ${OPENSSL_SOURCES_DIR}/crypto/dllmain.c |
29 | 29 |
30 **/ | 30 **/ |
31 | 31 |
32 #if defined(_WIN32) || defined(__CYGWIN__) | 32 #if defined(_WIN32) || defined(__CYGWIN__) |
33 # ifdef __CYGWIN__ | |
34 # include <windows.h> | |
35 # endif | |
36 | 33 |
37 #include "e_os.h" | 34 #include <boost/thread/detail/tss_hooks.hpp> |
38 #include "crypto/cryptlib.h" | |
39 | 35 |
40 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) | 36 #include <windows.h> |
37 | |
38 #include <crypto/cryptlib.h> | |
39 | |
40 #if defined(__BORLANDC__) | |
41 extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/) | |
42 #elif defined(_WIN32_WCE) | |
43 extern "C" BOOL WINAPI DllMain(HANDLE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/) | |
44 #else | |
45 extern "C" BOOL WINAPI DllMain(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/) | |
46 #endif | |
41 { | 47 { |
42 switch (fdwReason) | 48 switch(dwReason) |
43 { | 49 { |
44 case DLL_PROCESS_ATTACH: | 50 case DLL_PROCESS_ATTACH: |
51 { | |
45 //OPENSSL_cpuid_setup(); // TODO - Is this necessary? | 52 //OPENSSL_cpuid_setup(); // TODO - Is this necessary? |
53 boost::on_process_enter(); | |
54 boost::on_thread_enter(); | |
46 break; | 55 break; |
47 | 56 } |
57 | |
48 case DLL_THREAD_ATTACH: | 58 case DLL_THREAD_ATTACH: |
59 { | |
60 boost::on_thread_enter(); | |
49 break; | 61 break; |
50 | 62 } |
63 | |
51 case DLL_THREAD_DETACH: | 64 case DLL_THREAD_DETACH: |
65 { | |
52 OPENSSL_thread_stop(); | 66 OPENSSL_thread_stop(); |
67 boost::on_thread_exit(); | |
53 break; | 68 break; |
54 | 69 } |
70 | |
55 case DLL_PROCESS_DETACH: | 71 case DLL_PROCESS_DETACH: |
72 { | |
73 boost::on_thread_exit(); | |
74 boost::on_process_exit(); | |
56 break; | 75 break; |
76 } | |
57 } | 77 } |
58 | 78 |
59 return TRUE; | 79 return TRUE; |
60 } | 80 } |
61 | 81 |
62 #endif | 82 #endif |
63 | 83 |