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