mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
33366b0a4ecc190efb9dcf2607dfb50958aa2aeb

My simplification of the conditions for including SDL_main_impl.h had one problem: I forgot that SDL_main_impl.h must be included even on Android when SDL_MAIN_USE_CALLBACKS is used, because then a SDL_main() function that makes sure the callbacks get called is needed, and that function is implemented in SDL_main_impl.h But OTOH, even when SDL_MAIN_USE_CALLBACKS is used, SDL_main_impl.h should not implement a standard `int main(...)` function on Android (because there the SDL-using native code is compiled as a library and the entry point is in SDLActivity.java, which calls SDL_main() in said library). So the check for platforms that don't have *any* native main function but just SDL_main() called from the outside should be handled in SDL_main_impl.h, so both the normal and the callback case can avoid generating a standard main() in the same way. To do this, SDL_MAIN_EXPORTED is defined for platforms like Android, where the real entry point (main() function) is outside of the code that uses SDL, so - SDL_main() must be visibly exported with SDL_DECLSPEC, so the outside code can call it - SDL_main_impl.h must not implement a "real" main() function Another small change based on this is defining SDLMAIN_DECLSPEC at a more general place. If another platform like Android (where the entry point is somewhere else entirely, possibly implemented in a different programming language) turns up, defining SDL_MAIN_NEEDED (so the users main() is renamed to SDL_main()) and SDL_MAIN_EXPORTED should be all that's needed on the SDL_main.h side - and if not then at least the implementation is cleaner and clearer now, IMHO. fixes #11162
Simple DirectMedia Layer (SDL) Version 3.0
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.
More extensive documentation is available in the docs directory, starting with README.md. If you are migrating to SDL 3.0 from SDL 2.0, the changes are extensively documented in README-migration.md.
Enjoy!
Sam Lantinga (slouken@libsdl.org)
Languages
C
86.4%
C++
5.9%
Objective-C
3.4%
CMake
1.6%
Perl
0.8%
Other
1.7%