SDL_GetPlatform(3)

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

okay bestie, buckle up, we're doing a manual page and it's literally gonna be fun. this is SDL_GetPlatform, from the SDL3 FUNCTIONS collection. it answers the most iconic question of all time: what platform am i even on rn?? πŸ¦‹


🌸 NAME 🌸

SDL_GetPlatform β€” get the name of the platform. that's it. that's the whole job. she's simple, she's reliable, she ate πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_platform.h>

const char * SDL_GetPlatform(void);

no args, no drama, no parameters. she takes nothing and gives you a string. queen behavior πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

so here's the tea β€” this function hands you back the name of the platform you're running on. and here are the names it returns for some (but not all) of the supported platforms, bestie:

  • "Windows"
  • "macOS"
  • "Linux"
  • "iOS"
  • "Android"
not me emphasizing "some (but not all)" β€” that's straight from the source, don't come for me. there are more platforms out there, these are just the ones the docs are showing off πŸ™ˆ

πŸ’œ RETURN VALUE πŸ’œ

returns the name of the platform. simple, clean, gorgeous.

but β€” and this is important β€” if the correct platform name is not available, it returns a string that begins with the text "Unknown". so like, if you see something starting with "Unknown", that's your sign that the platform name wasn't there. keep an eye out for it, iykyk πŸ‘€


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. literally any of them. go feral, call it from all of them at once, she does not care. iconic multi-threaded energy 🌈


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. if you're on anything older... bestie, we need to talk πŸ’€


🫢 SEE ALSO 🫢

okay so the original page didn't give us a SEE ALSO section, which is honestly a little tragic, but we move. you've got everything you need right here anyway πŸ’–


and that's the whole page, no cap!! sending you off with love from the Simple Directmedia Layer crew β€” this was SDL 3.4.18, dated SDL_GetPlatform(3), and yes she's still serving. go forth and platform-detect responsibly, bestie πŸŽ€βœ¨πŸ¦‹πŸ’…πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’œπŸ“

πŸ“¦ where this page comes from