| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

DllMain.icpp
Go to the documentation of this file.
1 //====================================================================
2 // DllMain.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : Gaudi/System
6 //
7 // Description: The DLL initialisation must be done seperately for
8 // each DLL.
9 //
10 // Author : M.Frank
11 // Created : 13/1/99
12 // Changes :
13 //
14 //====================================================================
15 #ifndef SYSTEM_DLLMAIN_ICPP
16 #define SYSTEM_DLLMAIN_ICPP 1
17
18 #include "GaudiKernel/Kernel.h"
19 #include "GaudiKernel/System.h"
20
21 #if !defined(__APPLE__)
22 class GaudiDll {
23 GaudiDll() {}
24 public:
25 static void initialize(void* hinstDLL);
26 static void finalize(void* hinstDLL);
27 };
28 #endif
29
30 #if defined(_WIN32) && defined(_DLL)
31 namespace win {
32 // Avoid conflicts between Windows' headers and MSG.
33 #ifndef NOMSG
34 # define NOMSG
35 # ifndef NOGDI
36 # define NOGDI
37 # endif
38 #endif
39 #include <windows.h>
40 }
41
42 win::BOOL APIENTRY DllMain(
43 win::HINSTANCE hinstDLL, // handle to DLL module
44 win::DWORD fdwReason, // reason for calling function
45 win::LPVOID lpvReserved // reserved
46 )
47 {
48 System::setModuleHandle(hinstDLL);
49 switch( fdwReason ) {
50 case DLL_PROCESS_ATTACH: {
51 GaudiDll::initialize(hinstDLL);
52 }
53 break;
54 case DLL_THREAD_ATTACH:
55 break;
56 case DLL_THREAD_DETACH:
57 break;
58 case DLL_PROCESS_DETACH: {
59 GaudiDll::finalize(hinstDLL);
60 // Since the System class is shared now, we may no longer close the
61 // Process handle! M.F.
62 //win::CloseHandle(System::processHandle());
63 }
64 break;
65 }
66 return TRUE;
67
68 }
69 #elif __linux
70 static void _init() __attribute__((constructor));
71 static void _fini() __attribute__((destructor));
72
73 static void _init() {
74 GaudiDll::initialize(0);
75 }
76 static void _fini() {
77 GaudiDll::finalize(0);
78 }
79 #elif defined(__APPLE__)
80 static void _init() __attribute__((constructor));
81 static void _fini() __attribute__((destructor));
82
83 static void _init() {
84 //FIXME GaudiDll::initialize(0);
85 }
86 static void _fini() {
87 //FIXME GaudiDll::finalize(0);
88 }
89
90 #endif // WIN32
91
92 #endif // SYSTEM_DLLMAIN_ICPP
System.h
__attribute__
#define __attribute__(x)
Definition: System.cpp:72
Kernel.h
GaudiDll::initialize
static void initialize(void *hinstDLL)
Definition: LoadFactoryEntries.h:19
System::setModuleHandle
GAUDI_API void setModuleHandle(ImageHandle handle)
Attach module handle.
Definition: ModuleInfo.cpp:136
GaudiDll
Definition: DllMain.icpp:22
GaudiKernel.Constants.TRUE
bool TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Constants.py:20
GaudiDll::finalize
static void finalize(void *hinstDLL)
Definition: LoadFactoryEntries.h:20
GaudiDll::GaudiDll
GaudiDll()
Definition: DllMain.icpp:23