[project @ 2000-04-26 17:27:00 by rrt]
[ghc-hetmet.git] / ghc / rts / RtsDllMain.c
1 /* -----------------------------------------------------------------------------
2  * $Id: RtsDllMain.c,v 1.2 2000/04/26 17:27:00 rrt Exp $
3  *
4  * (c) The GHC Team 1999-2000
5  *
6  * Entry point for RTS-in-a-DLL
7  *
8  * ---------------------------------------------------------------------------*/
9
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 */