00001
00009
00010
00011
00012
00013
00014
00015 #define DLMAIN
00016
00017
00018 #define MAJOR 0
00019 #define MINOR 0
00020
00021 #include <stdlib.h>
00022 #include "gridlabd.h"
00023
00024 EXPORT int do_kill(void*);
00025
00026 EXPORT int major=MAJOR, minor=MINOR;
00027
00028 #ifdef WIN32
00029 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
00030 #include <windows.h>
00031
00032 BOOL APIENTRY DllMain( HANDLE hModule,
00033 DWORD ul_reason_for_call,
00034 LPVOID
00035 )
00036 {
00037 switch (ul_reason_for_call)
00038 {
00039 case DLL_PROCESS_ATTACH:
00040 case DLL_THREAD_ATTACH:
00041 break;
00042 case DLL_THREAD_DETACH:
00043 case DLL_PROCESS_DETACH:
00044 do_kill(hModule);
00045 break;
00046 }
00047 return TRUE;
00048 }
00049
00050 #else // !WIN32
00051
00052 CDECL int dllinit() __attribute__((constructor));
00053 CDECL int dllkill() __attribute__((destructor));
00054
00055 CDECL int dllinit()
00056 {
00057 return 0;
00058 }
00059
00060 CDECL int dllkill() {
00061 do_kill(NULL);
00062 }
00063
00064 #endif // !WIN32
00065