Go to file
Daniel Gibson 33366b0a4e Fix SDL_MAIN_USE_CALLBACKS with Android, introduce SDL_MAIN_EXPORTED
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
2024-10-11 18:54:29 -07:00
.github ci: actions/cache might return a boolean as string 2024-10-08 18:53:29 +02:00
VisualC Added SDL_murmur3_32() 2024-09-28 17:19:01 -07:00
VisualC-GDK Added SDL_murmur3_32() 2024-09-28 17:19:01 -07:00
Xcode Updated to version 3.1.5 for development 2024-10-09 11:02:01 -07:00
android-project Add more configChanges to Android Manifest (#11145) 2024-10-10 07:53:34 -07:00
build-scripts fnsince.pl: Make fixes now that we've reached ABI lock. 2024-10-10 12:41:46 -04:00
cmake cmake: don't prepend absolute CMAKE_INSTALL_{INCLUDE,LIB}DIR with ${prefix} 2024-09-14 16:21:42 +02:00
docs Sync SDL3 wiki -> header 2024-10-11 20:51:42 +00:00
examples examples: add basic app metadata to all existing examples. 2024-10-07 17:41:15 -04:00
include Fix SDL_MAIN_USE_CALLBACKS with Android, introduce SDL_MAIN_EXPORTED 2024-10-11 18:54:29 -07:00
src Fixed converting full range YUV to RGB 2024-10-11 18:12:05 -07:00
test test/testautomation_stdlib.c: fix gcc warning on 32 bit 2024-10-10 21:10:24 +03:00
wayland-protocols wayland: Add support for setting window icons via the xdg-toplevel-icon-v1 protocol 2024-08-31 09:38:43 -04:00
.clang-format Add 'wl_list_for_each_safe' to the clang-format macro list 2024-03-14 10:22:23 -04:00
.clang-tidy
.editorconfig .editorconfig: Remove excess apostrophe at *.cocci 2024-06-16 09:18:17 -07:00
.gitignore Add the SDL_GPU API 2024-08-29 15:57:29 -07:00
.wikiheaders-options .wikiheaders-options: Declare SDL3 to be a stable API! 2024-10-04 15:38:32 -04:00
Android.mk Add SDL_Process subsystem 2024-09-13 15:19:32 -07:00
BUGS.txt Replaced \r\n with \n in SDL root files 2024-10-05 18:15:02 -07:00
CMakeLists.txt Updated to version 3.1.5 for development 2024-10-09 11:02:01 -07:00
CREDITS.md docs: Moved CREDITS and INSTALL to markdown format. 2023-11-29 12:31:27 -05:00
INSTALL.md Updated INSTALL.md 2024-04-10 09:18:42 -04:00
LICENSE.txt Updated copyright for 2024 2024-01-01 13:15:26 -08:00
README-SDL.txt Replaced \r\n with \n in SDL root files 2024-10-05 18:15:02 -07:00
README.md Tweaking documentation for the SDL 3.0 preview release 2024-03-24 06:16:02 -07:00
WhatsNew.txt Replaced \r\n with \n in SDL root files 2024-10-05 18:15:02 -07:00

README.md

Simple DirectMedia Layer (SDL) Version 3.0

https://www.libsdl.org/

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)