af3c5090de9527d37dac7517ff818094d2b808f4
[ghc-hetmet.git] / rts / RtsDllMain.c
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team 1999-2000
4  *
5  * Entry point for RTS-in-a-DLL
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #include "PosixSource.h"
10 #include "Rts.h"
11 #include "RtsAPI.h"
12
13 #ifdef HAVE_WINDOWS_H
14 #include <windows.h>
15 #endif
16
17 /* I'd be mildly surprised if this wasn't defined, but still. */
18 #ifdef ENABLE_WIN32_DLL_SUPPORT
19
20 BOOL
21 WINAPI
22 DllMain ( HINSTANCE hInstance
23         , DWORD reason
24         , LPVOID reserved
25         )
26 {
27   /*
28    * Note: the DllMain() doesn't call startupHaskell() for you,
29    *       that is the task of users of the RTS. The reason is
30    *       that *you* want to be able to control the arguments
31    *       you pass to the RTS.
32    */
33   switch (reason) {
34   case DLL_PROCESS_DETACH: shutdownHaskell();
35   }
36   return TRUE;
37 }
38
39 #endif /* ENABLE_WIN32_DLL_SUPPORT */