Created
February 22, 2011 20:31
-
-
Save alvivi/839329 to your computer and use it in GitHub Desktop.
c_main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "HsFFI.h" | |
#ifdef __APPLE__ | |
#include <objc/objc.h> | |
#include <objc/objc-runtime.h> | |
#endif | |
#include <SDL.h> | |
#ifdef __GLASGOW_HASKELL__ | |
#include "HSMain_stub.h" | |
extern void __stginit_HSMain ( void ); | |
#endif | |
int SDL_main(int argc, char *argv[]) | |
{ | |
int i; | |
#ifdef __APPLE__ | |
void * pool = | |
objc_msgSend(objc_lookUpClass("NSAutoreleasePool"), sel_getUid("alloc")); | |
objc_msgSend(pool, sel_getUid("init")); | |
#endif | |
hs_init(&argc, &argv); | |
#ifdef __GLASGOW_HASKELL__ | |
hs_add_root(__stginit_HSMain); | |
#endif | |
hs_main(); | |
hs_exit(); | |
#ifdef __APPLE__ | |
objc_msgSend(pool, sel_getUid("release")); | |
#endif | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment