SDL_EnterAppMainCallbacks(3)

πŸ’– SDL_EnterAppMainCallbacks(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, this one's called SDL_EnterAppMainCallbacks and it's lowkey a secret backstage door. let's get into it πŸŽ€


✨ NAME ✨

SDL_EnterAppMainCallbacks β€” the entry point that SDL uses when you're rolling with SDL_MAIN_USE_CALLBACKS. it's giving "backstage pass" energy 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_main.h>

int SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit);

look at all those callback params, it's literally a whole friend group 🧚


πŸ’… DESCRIPTION πŸ’…

okay so generally you should NOT call this function directly. like, fr fr. this thing only exists so SDL can hand off work into itself ASAP β€” that way SDL has so much more control and functionality available to it, and the inline code in SDL_main.h stays as smol and cute as possible ✨

and btw, not every platform even uses this. its actual use is hidden inside a magic header-only library πŸͺ„ (yes, magic, we said what we said). so you should not call this directly unless you _really_ know what you're doing. emphasis on really, bestie, we're being so serious 😭

πŸ’€ calling this when you don't 100% know what you're doing is not the vibe. it's not a "just try it and see" situation. iykyk.

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • argc β€” standard Unix main argc. the classic. the icon. the number-of-args situation πŸ‘‘
  • argv β€” standard Unix main argv. the actual args themselves, slaying in array form πŸ’œ
  • appinit β€” the application's SDL_AppInit function. your little init moment 🌱
  • appiter β€” the application's SDL_AppIterate function. the loop girlie, doing her rounds on repeat πŸ”
  • appevent β€” the application's SDL_AppEvent function. catching every event like it's gossip πŸ“
  • appquit β€” the application's SDL_AppQuit function. the graceful goodbye, no dramatic exits 🌈

⭐ RETURN VALUE ⭐

returns the standard Unix main return value. nothing fancy, just the classic int, doing its thing πŸ’–


πŸŽ€ THREAD SAFETY πŸŽ€

🚨 it is not safe to call this anywhere except as the only function call in SDL_main. only. one. call. no friends allowed. periodt.

🌟 AVAILABILITY 🌟

this function is available since SDL 3.2.0 ✨ (so if you're on an older SDL, she's not there yet, be patient bestie πŸ¦‹)


and that's the whole page!! mwah πŸ’‹ this came to you from the fine people at Simple Directmedia Layer, SDL 3.4.18, and yeah it's SDL_EnterAppMainCallbacks(3) β€” go forth and do NOT call it directly unless you're built different πŸ’…πŸ’–

πŸ“¦ where this page comes from