SDL_MAIN_USE_CALLBACKS(3)
π SDL_MAIN_USE_CALLBACKS π
okay bestie, gather round, because this one is a tiny little macro that does so much behind the scenes. it lives in the SDL3 FUNCTIONS section of the manual, so you already know it's part of the big SDL3 era. let's get into it π«Ά
β¨ NAME β¨
SDL_MAIN_USE_CALLBACKS β the lil' define that tells SDL "hey, I'm not doing the whole main thing, I'm doing callbacks instead" π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_main.h>
#define SDL_MAIN_USE_CALLBACKS 1
that's it. that's the whole vibe. one include, one define, and SDL is obsessed with you. π
β¨ DESCRIPTION β¨
so here's the tea β β SDL does not define this macro itself. it just checks whether you defined it when you include SDL_main.h. so the ball is fully in your court, no cap.
if you do define it, SDL is gonna expect your app to hand over a whole little friend group of functions:
SDL_AppInitSDL_AppEventSDL_AppIterateSDL_AppQuit
that's the squad. those four. π
and the app should NOT provide a main function in this case β like, at all. if you do, it'll likely cause the build to fail. not a cute look, fr fr. π
if you want the full lore, the extended director's cut explanation, go read [README-main-functions](README-main-functions) β or if you're living in the source tree, it's at docs/README-main-functions.md. πΈ
β¨ AVAILABILITY β¨
this macro has been used by the headers since SDL 3.2.0. so if you're on anything older... bestie, respectfully, upgrade. π¦
β¨ SEE ALSO β¨
and that's the whole page, periodt β¨ this one came from the Simple Directmedia Layer crew, SDL 3.4.18 edition, and yeah it's the SDL_MAIN_USE_CALLBACKS(3) page, iconic behavior honestly. go forth and callback, bestie π
ππ«Ά
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms