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