home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxdllx.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  3KB  |  69 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. /////////////////////////////////////////////////////////////////////////////
  12. // AFXDLLX.H: Extra header for building an MFC Extension DLL
  13. //
  14. // This file is really a source file that you should include in the
  15. // main source file of your DLL.  It must only be included once, and
  16. // not multiple times (you will get linker errors if it is included
  17. // multiple times).  If you do not use _AFXEXT, it is not required
  18. // but you may want the feature it provides.
  19. //
  20. // Previous versions of 32-bit MFC did not require this file.  This version
  21. // requires this file to support dynamic loading of extension DLLs.  In
  22. // other words, if your application does LoadLibrary on any extension
  23. // DLL (instead of binding to the DLL at link time), this file is
  24. // required.
  25.  
  26. #ifdef _AFX_MINREBUILD
  27. #pragma component(minrebuild, off)
  28. #endif
  29. #ifndef _AFX_FULLTYPEINFO
  30. #pragma component(mintypeinfo, on)
  31. #endif
  32.  
  33. // The following symbol used to force inclusion of this module for _AFXEXT
  34. #if defined(_X86_)
  35. extern "C" { int _afxForceEXTDLL; }
  36. #else
  37. extern "C" { int __afxForceEXTDLL; }
  38. #endif
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // RawDllMain that saves current app class list and factory list
  42.  
  43. extern "C" BOOL WINAPI ExtRawDllMain(HINSTANCE, DWORD dwReason, LPVOID);
  44. extern "C" BOOL (WINAPI* _pRawDllMain)(HINSTANCE, DWORD, LPVOID) = &ExtRawDllMain;
  45.  
  46. extern "C"
  47. BOOL WINAPI ExtRawDllMain(HINSTANCE, DWORD dwReason, LPVOID)
  48. {
  49.     if (dwReason == DLL_PROCESS_ATTACH)
  50.     {
  51.         // save critical data pointers before running the constructors
  52.         AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
  53.         pModuleState->m_pClassInit = pModuleState->m_classList;
  54.         pModuleState->m_pFactoryInit = pModuleState->m_factoryList;
  55.         pModuleState->m_classList.m_pHead = NULL;
  56.         pModuleState->m_factoryList.m_pHead = NULL;
  57.     }
  58.     return TRUE;    // ok
  59. }
  60.  
  61. #ifdef _AFX_MINREBUILD
  62. #pragma component(minrebuild, on)
  63. #endif
  64. #ifndef _AFX_FULLTYPEINFO
  65. #pragma component(mintypeinfo, off)
  66. #endif
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69.