use createDirectoryIfMissing for mkdirhier
[intricacy.git] / c_main.c
blob12a6cd2b6d8999d14d97edb33c4246144636480a
1 /* Workaround for SDL on OS X, based on the corresponding file in TimePiece-0.0.5
2 * http://hackage.haskell.org/package/TimePiece ,
3 * placed in the public domin by by Audrey Tang <audreyt@audreyt.org>. */
4 #include <stdio.h>
5 #include "HsFFI.h"
7 #ifdef __APPLE__
8 #include <objc/objc.h>
9 #include <objc/objc-runtime.h>
10 #endif
12 #include <SDL.h>
14 #ifdef __GLASGOW_HASKELL__
15 #include "Main_stub.h"
16 extern void __stginit_Main ( void );
17 #endif
19 #ifdef main
20 int SDL_main(int argc, char *argv[])
21 #else
22 int main(int argc, char *argv[])
23 #endif
25 int i;
27 #ifdef __APPLE__
28 void * pool =
29 objc_msgSend(objc_lookUpClass("NSAutoreleasePool"), sel_getUid("alloc"));
30 objc_msgSend(pool, sel_getUid("init"));
31 #endif
33 hs_init(&argc, &argv);
34 #ifdef __GLASGOW_HASKELL__
35 hs_add_root(__stginit_Main);
36 #endif
38 hs_MAIN();
40 hs_exit();
42 #ifdef __APPLE__
43 objc_msgSend(pool, sel_getUid("release"));
44 #endif
45 return 0;