SDL_GetVersion(3)

πŸ’– SDL_GetVersion πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_GetVersion β€” she's short, she's sweet, and she tells you exactly which SDL you're actually cuddling with at runtime. let's get into it πŸ¦‹


✨ NAME ✨

SDL_GetVersion β€” get the version of SDL that is linked against your program.

like, not the one you thought you had. the one you actually have. vibe check for your shared library πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_version.h>

int SDL_GetVersion(void);

no args, no drama, no parameters. she just knows πŸŽ€


πŸ’« DESCRIPTION πŸ’«

so here's the tea, and it's genuinely important tea: if you're linking to SDL dynamically, then it's totally possible that the current version is different from the version you compiled against. like, you built your whole thing against one SDL and then the system hands you another one at runtime. rude? maybe. real? absolutely 😭

SDL_GetVersion returns the current version β€” the one actually linked against your program right now.

meanwhile SDL_VERSION is the version you compiled with. two different girls, two different jobs. don't mix them up, i'm begging πŸ™ˆ

the way that this function may be called safely at any time, even before SDL_Init(). no setup, no init, no waiting. she's ready whenever you are, lowkey iconic ⭐

πŸ‘‘ RETURN VALUE πŸ‘‘

returns the version of the linked library. that's it, that's the whole return. the version of the linked library 🫢


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. all of them. every single one. she's not picky, she's not messy, she's just built different πŸ’œ


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on something older... bestie. no cap. you gotta update πŸ“…βœ¨


πŸ“ SEE ALSO πŸ“


Simple Directmedia Layer 🌸 SDL 3.4.18 🌸 SDL_GetVersion(3)

and that's the whole page, bestie!! written by the Simple Directmedia Layer girlies, version SDL 3.4.18, and yes this is the SDL_GetVersion(3) page you just read, so you're already here, slay πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from