SDL_MAIN_NEEDED(3)
π NAME π
SDL_MAIN_NEEDED β bestie, this one's a macro that's only defined when your target platform literally requires a special mainline through SDL. Like, no mainline through SDL, no vibes. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_main.h>
#define SDL_MAIN_NEEDED
πΈ DESCRIPTION πΈ
Okay so, plot twist: if your platform doesn't need it, this won't be defined at all. Not even a little. It's giving "only shows up when it's needed." π
But if it is defined? Then SDL's headers will redefine main to SDL_main. Yes, for real, they just do that. π
Also important, iykyk: this macro is defined by SDL_main.h, and SDL_main.h is not automatically included by SDL.h. So if you're out here wondering why you don't see it, that's why, bestie. It's not sneaking in with the rest. π¦
And even if your platform does require it, an app can still define SDL_MAIN_HANDLED and provide their own main β but only if they know what they're doing. That's the whole caveat, fr fr. Don't come for me if you rawdog it without knowing. π
Heads up: this macro is used internally by SDL, and apps probably shouldn't rely on it. It's not yours, it's SDL's, okay? Not me gatekeeping, it's literally in the docs. π«Ά
β AVAILABILITY β
This macro has been available since SDL 3.2.0. Iconic behavior, honestly. π
And that's the whole page, angel π β brought to you by Simple Directmedia Layer, version SDL 3.4.18, from the SDL3 FUNCTIONS era of the manual. Slay, go forth, and don't touch SDL_MAIN_NEEDED unless you must. Periodt. πβ¨
π¦ 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