Hi experts,
Should I expect the following C code to run to completion, or am I trying
to do something that was never intended?
Thanks,
-db
C code:
  1 #include 
  2 #include 
  3 #include "HsFFI.h"
  4
  5 int main()
  6 {
  7     int argc = 1, i;
  8     char* argv[] = {"ghcDll", NULL}; // argv must end with NULL
  9     char** args = argv;
 10
 11     for(i=0; i<10; i++) {
 12         fprintf(stderr, "Starting up the RTS...\n");
 13         hs_init(&argc, &args);
 14         printf("Shutting down the RTS...\n");
 15         hs_exit();
 16     }
 17 }
This is what I get, when I compile and run it:
dbanas@dbanas-eeepc:~/prj/haskell/amitool$ make test_rts
rm -f test_rts
ghc -o test_rts -lHSrts -lm -lffi -lrt test_rts.o
dbanas@dbanas-eeepc:~/prj/haskell/amitool$ ./test_rts
Starting up the RTS...
Shutting down the RTS...
Starting up the RTS...
Shutting down the RTS...
Segmentation fault