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