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