SDL_MAIN_HANDLED(3)

πŸ’– NAME πŸ’–

SDL_MAIN_HANDLED β€” the lil macro that tells SDL "bestie, I got this one, I'm bringing my own entry point" instead of letting SDL handle it 🫢


✨ SYNOPSIS ✨

#include <SDL3/SDL_main.h>

#define SDL_MAIN_HANDLED 1

🌸 DESCRIPTION 🌸

okay so first thing's first, and this is important: SDL does not define this macro. Like, it's not a thing SDL hands you. You define it. SDL just checks whether it's defined at the moment you #include <SDL3/SDL_main.h>. Vibe check on a macro. πŸ‘€

And if it is defined? Then SDL is like "okay periodt, you're the main character now" β€” it will expect the app to provide the proper entry point for the platform, plus all the other magic details needed, like manually calling SDL_SetMainReady. Yes, you. Manually. With your own two hands. πŸ’…

⚠️ so yeah, no cap: once SDL_MAIN_HANDLED is set, the platform entry point and the magic setup are your problem. SDL is not doing that for you anymore.

If you want the whole deep dive, go read [README-main-functions](README-main-functions) β€” or if you're kicking it in the source tree, it's at docs/README-main-functions.md. That's the one with the actual detailed explanation, fr fr. πŸ“–βœ¨


πŸ¦‹ AVAILABILITY πŸ¦‹

This macro has been used by the headers since SDL 3.2.0. iconic behavior tbh. πŸ‘‘


mwah πŸ’‹ that's the whole page, hope it slayed for you. this lil writeup comes to you from Simple Directmedia Layer, living in SDL 3.4.18 times β€” go forth and handle your own main, bestie, I believe in you πŸŒˆπŸŽ€πŸ’œ

πŸ“¦ where this page comes from