OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
atom_types.cc
Go to the documentation of this file.
1 
9 // library initialization
10 #if defined(WIN32) && defined(_DLL)
11 namespace win {
12 #include <windows.h>
13 }
14 
15 win::BOOL APIENTRY DllMain(win::HINSTANCE hinstDLL, // handle to DLL module
16  win::DWORD fdwReason, // reason for calling function
17  win::LPVOID lpvReserved) // reserved
18 {
19  System::setModuleHandle(hinstDLL);
20  switch (fdwReason) {
21  case DLL_PROCESS_ATTACH:
22  #include INHERITANCE_FILE
23  #ifdef INHERITANCE_FILE2
24  #include INHERITANCE_FILE2
25  #endif
26  break;
27  case DLL_THREAD_ATTACH:
28  break;
29  case DLL_THREAD_DETACH:
30  break;
31  case DLL_PROCESS_DETACH:
32  break;
33  }
34  return TRUE;
35 }
36 #elif __GNUC__
37 static __attribute__ ((constructor)) void init(void)
38 {
39  #include INHERITANCE_FILE
40  #ifdef INHERITANCE_FILE2
41  #include INHERITANCE_FILE2
42  #endif
43 }
44 
45 static __attribute__ ((destructor)) void fini(void)
46 {
47 }
48 
49 #endif
50 
51 extern "C" {
52 // Calling this forces this shared-lib to load, thus calling the
53 // constructor above, thus causing the atom types to be loaded into
54 // the atomspace.
55 void INITNAME(void)
56 {
57  /* No-op */
58 }
59 };
void INITNAME(void)
Definition: atom_types.cc:55
static __attribute__((constructor)) void init(void)
Definition: ClassServer.cc:168