[SDL] Importance of SDL_Quit()

Ryan C. Gordon icculus at icculus.org
Sat Jul 23 23:08:07 PDT 2011


> At the beginning. Not sure what would happen if you called SDL_Quit
> manually as well though...

You can call SDL_Quit() multiple times. It's safe to do so.


The truly pedantic will point out that, on some platforms, you can't 
call atexit(SDL_Quit()), because SDL entry points aren't guaranteed to 
be cdecl calling conventions, but this works...

     static void sdlquit(void) { SDL_Quit(); }
     // later...
     atexit(sdlquit);

...and modern versions of Mac OS X can do this awesomeness...

     atexit_b( ^{ SDL_Quit(); } );

...because Blocks make everything cooler.  :)

--ryan.




More information about the SDL mailing list