Chris@16
|
1 #ifndef BOOST_THREAD_WIN32_MFC_THREAD_INIT_HPP
|
Chris@16
|
2 #define BOOST_THREAD_WIN32_MFC_THREAD_INIT_HPP
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
4 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 // (C) Copyright 2008 Anthony Williams
|
Chris@16
|
7 // (C) Copyright 2011-2012 Vicente J. Botet Escriba
|
Chris@16
|
8
|
Chris@16
|
9
|
Chris@16
|
10 // check if we use MFC
|
Chris@16
|
11 #ifdef _AFXDLL
|
Chris@16
|
12 # if defined(_AFXEXT)
|
Chris@16
|
13
|
Chris@16
|
14 // can't use ExtRawDllMain from afxdllx.h as it also defines the symbol _pRawDllMain
|
Chris@16
|
15 extern "C"
|
Chris@16
|
16 inline BOOL WINAPI ExtRawDllMain(HINSTANCE, DWORD dwReason, LPVOID)
|
Chris@16
|
17 {
|
Chris@16
|
18 if (dwReason == DLL_PROCESS_ATTACH)
|
Chris@16
|
19 {
|
Chris@16
|
20 // save critical data pointers before running the constructors
|
Chris@16
|
21 AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
|
Chris@16
|
22 pModuleState->m_pClassInit = pModuleState->m_classList;
|
Chris@16
|
23 pModuleState->m_pFactoryInit = pModuleState->m_factoryList;
|
Chris@16
|
24 pModuleState->m_classList.m_pHead = NULL;
|
Chris@16
|
25 pModuleState->m_factoryList.m_pHead = NULL;
|
Chris@16
|
26 }
|
Chris@16
|
27 return TRUE; // ok
|
Chris@16
|
28 }
|
Chris@16
|
29
|
Chris@16
|
30 extern "C" __declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &ExtRawDllMain;
|
Chris@16
|
31
|
Chris@16
|
32 # elif defined(_USRDLL)
|
Chris@16
|
33
|
Chris@16
|
34 extern "C" BOOL WINAPI RawDllMain(HANDLE, DWORD dwReason, LPVOID);
|
Chris@16
|
35 extern "C" __declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &RawDllMain;
|
Chris@16
|
36
|
Chris@16
|
37 # endif
|
Chris@16
|
38 #endif
|
Chris@16
|
39
|
Chris@16
|
40 #endif
|