[project @ 2004-02-12 02:04:59 by mthomas]
[ghc-hetmet.git] / ghc / rts / HsFFI.c
1 /* -----------------------------------------------------------------------------
2  * $Id: HsFFI.c,v 1.2 2003/01/28 16:30:06 simonmar Exp $
3  *
4  * (c) The GHC Team, 2002
5  *
6  * RTS entry points as mandated by the FFI addendum to the Haskell 98 report
7  *
8  * ---------------------------------------------------------------------------*/
9
10 #include "HsFFI.h"
11 #include "Rts.h"
12
13 // hs_init and hs_exit are defined in RtsStartup.c
14
15 void
16 hs_set_argv(int argc, char *argv[])
17 {
18     prog_argc = argc;
19     prog_argv = argv;
20 }
21
22 void
23 hs_perform_gc(void)
24 {
25     /* Hmmm, the FFI spec is a bit vague, but it seems to imply a major GC... */
26     performMajorGC();
27 }
28
29 void
30 hs_free_stable_ptr(HsStablePtr *sp)
31 {
32     /* The cast is for clarity only, both HsStablePtr and StgStablePtr are
33        typedefs for void*. */
34     freeStablePtr((StgStablePtr)sp);
35 }
36
37 void
38 hs_free_fun_ptr(HsFunPtr *fp)
39 {
40     /* I simply *love* all these similar names... */
41     freeHaskellFunctionPtr(fp);
42 }