SDL_DECLSPEC(3)

πŸ’… SDL_DECLSPEC πŸ’…

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, this one's literally called SDL_DECLSPEC(3) and it's short but it's iconic 🫢


✨ NAME ✨

SDL_DECLSPEC β€” a macro that tags a symbol as a public API. that's it. that's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

#include <SDL3/SDL_begin_code.h>

#define SDL_DECLSPEC __attribute__ ((visibility("default")))

✨ DESCRIPTION ✨

so, like, SDL uses this macro on all of its public functions. every single one. no cap. πŸ’…

on some targets, it's the thing that signals to the compiler "hey bestie, this function needs to be exported from a shared library," but ngl it might also have other side effects depending on where you're building. it's giving "multitasking icon" ✨

and here's the cute part: this symbol shows up all over SDL's headers, but apps and other libraries are totally welcome to use it for their own interfaces too. it's not gatekept. it's community property fr fr πŸ¦‹

lowkey a little macro doing a lot of heavy lifting for the whole shared-library situation, and we love her for it. πŸ‘‘

✨ AVAILABILITY ✨

this macro has been available since SDL 3.2.0. so if you're on anything older… bestie, respectfully, time to update. 😭


and that's the whole page!! tysm for reading, mwah πŸ’‹

Simple Directmedia Layer 🌸 SDL 3.4.18 🌈 SDL_DECLSPEC(3) β€” slay, periodt, go export some symbols πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from