1 #include <windef.h>
2 
3 #ifdef BUILD_DLL
4     #define DLL_EXPORT __declspec(dllexport)
5 #else
6     #define DLL_EXPORT
7 #endif
8 
9 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
10 {
11     switch (fdwReason)
12     {
13         case DLL_PROCESS_ATTACH:
14             // attach to process
15             // return FALSE to fail DLL load
16             break;
17 
18         case DLL_PROCESS_DETACH:
19             // detach from process
20             break;
21 
22         case DLL_THREAD_ATTACH:
23             // attach to thread
24             break;
25 
26         case DLL_THREAD_DETACH:
27             // detach from thread
28             break;
29     }
30     return TRUE; // succesful
31 }
32