1 #ifndef BOOST_THREAD_WIN32_MFC_THREAD_INIT_HPP
2 #define BOOST_THREAD_WIN32_MFC_THREAD_INIT_HPP
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // (C) Copyright 2008 Anthony Williams
7 // (C) Copyright 2011-2012 Vicente J. Botet Escriba
10 // check if we use MFC
14 // can't use ExtRawDllMain from afxdllx.h as it also defines the symbol _pRawDllMain
16 inline BOOL WINAPI ExtRawDllMain(HINSTANCE, DWORD dwReason, LPVOID)
18 if (dwReason == DLL_PROCESS_ATTACH)
20 // save critical data pointers before running the constructors
21 AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
22 pModuleState->m_pClassInit = pModuleState->m_classList;
23 pModuleState->m_pFactoryInit = pModuleState->m_factoryList;
24 pModuleState->m_classList.m_pHead = NULL;
25 pModuleState->m_factoryList.m_pHead = NULL;
30 extern "C" __declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &ExtRawDllMain;
32 # elif defined(_USRDLL)
34 extern "C" BOOL WINAPI RawDllMain(HANDLE, DWORD dwReason, LPVOID);
35 extern "C" __declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &RawDllMain;