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