SDL_SetMainReady(3)

okay so bestie, this is SDL_SetMainReady(3), and yes it's from the SDL3 FUNCTIONS manual πŸ’– no cap. It's the page that saves your SDL_Init() from doing a dramatic flop when your entry point isn't SDL_main(). Let's get into it ✨

πŸ’– NAME πŸ’–

SDL_SetMainReady β€” the function that circumvents failure of SDL_Init() when you're not using SDL_main() as an entry point. slay πŸŽ€

✨ SYNOPSIS ✨

#include <SDL3/SDL_main.h>

void SDL_SetMainReady(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the lore: this function is defined in SDL_main.h, along with the preprocessor rule that redefines main() as SDL_main() πŸ‘€.

That means if you want your own main() function to not get changed, you have to define SDL_MAIN_HANDLED before including SDL.h. literally define it first, bestie, before the include, or the preprocessor will do its little switcheroo πŸ’….

πŸ’… THREAD SAFETY πŸ’…

not thread safe. do not come at this one from multiple threads, bestie β€” it is not giving thread-safe energy. periodt 😭

πŸŽ€ AVAILABILITY πŸŽ€

  • available since SDL 3.2.0 ✨

🌈 SEE ALSO 🌈

  • SDL_Init(3) β€” go read that one too, it's the whole reason this function exists 🫢

mwah πŸ’‹ this page came from Simple Directmedia Layer, version SDL 3.4.18 β€” and the footer didn't give a date, so no date to spill. SDL_SetMainReady(3) out πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from