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