residential/main.cpp

00001 
00002 // main.cpp : Defines the entry point for the DLL application.
00003 //
00004 
00005 #define DLMAIN
00006 #define MAJOR 1
00007 #define MINOR 0
00008 
00009 #include <stdlib.h>
00010 #include "gridlabd.h"
00011 
00012 EXPORT int do_kill(void*);
00013 
00014 EXPORT int major=MAJOR, minor=MINOR;
00015 
00016 #ifdef WIN32
00017 
00018 #define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
00019 #include <windows.h>
00020 BOOL APIENTRY DllMain( HANDLE hModule, 
00021                        DWORD  ul_reason_for_call, 
00022                        LPVOID
00023                      )
00024 {
00025     switch (ul_reason_for_call)
00026     {
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     do_kill(NULL);
00050 }
00051 
00052 #endif // !WIN32

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy