SDL_Quit(3)

πŸ’– SDL_Quit(3) β€” the SDL3 FUNCTIONS glow-up πŸ’–

okay bestie, so you know how every party has to end? yeah. this is the party-ender. SDL_Quit is the function that cleans up all initialized subsystems β€” like, every single one. no crumbs left. ✨


πŸŽ€ NAME πŸŽ€

SDL_Quit β€” clean up all initialized subsystems. that's it. that's the whole job. and she does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_init.h>

void SDL_Quit(void);

no args, no return value, no drama. she takes nothing and gives you a clean slate. iconic behaviour honestly 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen. even if you've already shut down every initialized subsystem one by one with SDL_QuitSubSystem(), you should still call this function. yes, even then. she's not redundant, she's the final boss of cleanup. πŸ‘‘

and the best part? it's safe to call this function even if your initialization hit errors along the way. like, if SDL_Init was messy, if stuff blew up halfway through β€” doesn't matter. SDL_Quit does not care. she will not crash on you. she's chill like that. 😌

you can hook this up with atexit() so it automatically runs when your application shuts down β€” super convenient, lowkey a great move for your own app, fr fr.

⚠️ but bestie, do not do that from a library or any other dynamically loaded code. that's the one thing here that is not wise. putting atexit()-based SDL_Quit calls inside library code is a no. we don't do that. periodt. πŸ’€

πŸ”₯ THREAD SAFETY πŸ”₯

this one only gets called on the main thread. main character energy only, no side quests, no background threads, no exceptions. if you call it from anywhere else you're on your own, and we don't want that for you. πŸ™ˆ


⭐ AVAILABILITY ⭐

she's been serving since SDL 3.2.0. so if your SDL is older than that... girl, upgrade. 🧚


πŸ’œ SEE ALSO πŸ’œ

  • SDL_Init(3) β€” the one who starts it all (her other half, the beginning to her ending πŸ₯Ή)
  • SDL_QuitSubSystem(3) β€” the piece-by-piece shutdown, for when you wanna be thorough before the grand finale

okay that's the whole page, you're so welcome. this was brought to you by Simple Directmedia Layer, SDL 3.4.18, and this exact moment in time. go forth and clean up your subsystems, bestie β€” SDL_Quit has your back. πŸ“πŸŒˆπŸ’–

πŸ“¦ where this page comes from