Chris@16: #ifndef BOOST_THREAD_WIN32_MFC_THREAD_INIT_HPP Chris@16: #define BOOST_THREAD_WIN32_MFC_THREAD_INIT_HPP Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // (C) Copyright 2008 Anthony Williams Chris@16: // (C) Copyright 2011-2012 Vicente J. Botet Escriba Chris@16: Chris@16: Chris@16: // check if we use MFC Chris@16: #ifdef _AFXDLL Chris@16: # if defined(_AFXEXT) Chris@16: Chris@16: // can't use ExtRawDllMain from afxdllx.h as it also defines the symbol _pRawDllMain Chris@16: extern "C" Chris@16: inline BOOL WINAPI ExtRawDllMain(HINSTANCE, DWORD dwReason, LPVOID) Chris@16: { Chris@16: if (dwReason == DLL_PROCESS_ATTACH) Chris@16: { Chris@16: // save critical data pointers before running the constructors Chris@16: AFX_MODULE_STATE* pModuleState = AfxGetModuleState(); Chris@16: pModuleState->m_pClassInit = pModuleState->m_classList; Chris@16: pModuleState->m_pFactoryInit = pModuleState->m_factoryList; Chris@16: pModuleState->m_classList.m_pHead = NULL; Chris@16: pModuleState->m_factoryList.m_pHead = NULL; Chris@16: } Chris@16: return TRUE; // ok Chris@16: } Chris@16: Chris@16: extern "C" __declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &ExtRawDllMain; Chris@16: Chris@16: # elif defined(_USRDLL) Chris@16: Chris@16: extern "C" BOOL WINAPI RawDllMain(HANDLE, DWORD dwReason, LPVOID); Chris@16: extern "C" __declspec(selectany) BOOL (WINAPI * const _pRawDllMainOrig)(HANDLE, DWORD, LPVOID) = &RawDllMain; Chris@16: Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: #endif