1 /****************************************************************************** 2 ** $Header: svn+ssh://jmmcg@svn.code.sf.net/p/libjmmcg/code/trunk/libjmmcg/experimental/NT-based/NTSpecific/dll/libjmmcg.cpp 2055 2017-05-13 19:35:47Z jmmcg $ 3 ** 4 ** Copyright (C) 2004 by J.M.McGuiness, coder@hussar.me.uk 5 ** 6 ** This library is free software; you can redistribute it and/or 7 ** modify it under the terms of the GNU Lesser General Public 8 ** License as published by the Free Software Foundation; either 9 ** version 2.1 of the License, or (at your option) any later version. 10 ** 11 ** This library is distributed in the hope that it will be useful, 12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 ** Lesser General Public License for more details. 15 ** 16 ** You should have received a copy of the GNU Lesser General Public 17 ** License along with this library; if not, write to the Free Software 18 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 // libjmmcg.cpp : Defines the initialization routines for the DLL. 22 // 23 24 #include "stdafx.h" 25 26 #include "../../../../core/trace.hpp" 27 28 #include <afxdllx.h> 29 30 static AFX_EXTENSION_MODULE LibjmmcgDLL = { NULL, NULL }; 31 32 extern "C" int APIENTRY 33 DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 34 { 35 UNREFERENCED_PARAMETER(lpReserved); 36 37 if (dwReason == DLL_PROCESS_ATTACH) 38 { 39 JMMCG_TRACE(_T("LIBJMMCG.DLL Initializing! Instance: 0x")<<static_cast<void *>(hInstance)); 40 41 if (!AfxInitExtensionModule(LibjmmcgDLL, hInstance)) 42 return 0; 43 44 new CDynLinkLibrary(LibjmmcgDLL); 45 } 46 else if (dwReason == DLL_PROCESS_DETACH) 47 { 48 JMMCG_TRACE(_T("LIBJMMCG.DLL Terminating! Instance: 0x")<<static_cast<void *>(hInstance)); 49 AfxTermExtensionModule(LibjmmcgDLL); 50 } 51 return 1; 52 }