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