summaryrefslogtreecommitdiff
path: root/rts/RtsDllMain.c
blob: 250b63ea68e52889baa9dc9e129421734defddc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* -----------------------------------------------------------------------------
 *
 * (c) The GHC Team 1999-2000
 *
 * Entry point for RTS-in-a-DLL
 *
 * ---------------------------------------------------------------------------*/

#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"

#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif

/* I'd be mildly surprised if this wasn't defined, but still. */
#if defined(__PIC__) && defined(mingw32_TARGET_OS)
BOOL
WINAPI
DllMain ( HINSTANCE hInstance
        , DWORD reason
	, LPVOID reserved
	)
{
  /*
   * Note: the DllMain() doesn't call startupHaskell() for you,
   *       that is the task of users of the RTS. The reason is
   *       that *you* want to be able to control the arguments
   *       you pass to the RTS.
   */
  switch (reason) {
  case DLL_PROCESS_DETACH: shutdownHaskell();
  }
  return TRUE;
}

#endif /* defined(__PIC__) && defined(mingw32_TARGET_OS) */