d59c7a40a348f9273b46100e1b96a0e65aeae804
[ghc-hetmet.git] / rts / HsFFI.c
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 2005
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 #include "Storage.h"
12 #include "Stable.h"
13
14 // hs_init and hs_exit are defined in RtsStartup.c
15
16 void
17 hs_set_argv(int argc, char *argv[])
18 {
19     setProgArgv(argc,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 }