diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-10-01 16:13:41 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-10-01 16:13:41 +0200 |
commit | f025c0def98fd72f7e3180a208d896414c451e63 (patch) | |
tree | 79bd2805cae6307990dc6faf4e4406b53b65953d /src/main.cpp | |
parent | 7854c1a0c21193af3992ef672b322a27d41c883d (diff) | |
download | osc-graphics-f025c0def98fd72f7e3180a208d896414c451e63.tar.gz |
C linkage cleanup
* decleared main() with C linkage since it might be renamed to SDL_main and libSDLmain's startup code expects C linkage
* use a custom atexit() handler since SDL_Quit() calling conventions might differ from standard C calling conventions
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1f15c6e..f055db5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,13 @@ /* * Declarations */ +extern "C" { + +int main(int argc, char **argv); +static void cleanup(void); + +} + SDL_Surface *screen; OSCServer osc_server; @@ -194,7 +201,7 @@ main(int argc, char **argv) SDL_ERROR("SDL_Init"); return EXIT_FAILURE; } - atexit(SDL_Quit); + atexit(cleanup); SDL_WM_SetCaption("OSC Graphics", NULL); @@ -235,6 +242,12 @@ main(int argc, char **argv) return EXIT_FAILURE; } +static void +cleanup(void) +{ + SDL_Quit(); +} + #if defined(__WIN32__) && defined(main) #undef main /* |