SDL_LoadFunction(3)

πŸ’– SDL_LoadFunction(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, we're doing SDL_LoadFunction today and honestly? she's iconic. she finds stuff. πŸ¦‹


✨ NAME ✨

SDL_LoadFunction β€” look up the address of the named function in a shared object. literally her whole job, no notes. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_loadso.h>

SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name);

πŸŽ€ DESCRIPTION πŸŽ€

okay so, a few things you NEED to know before you go pointing at functions all willy-nilly:

  • This function pointer is no longer valid after calling SDL_UnloadObject(). like, gone gone. do not touch it. it's giving expired milk. πŸ’€
  • this function can only look up C function names. other languages may have name mangling and intrinsic language support that varies from compiler to compiler. so if you're out here looking for your fancy C++ overloaded thing, bestie, that's not the vibe she serves. πŸ™ˆ
  • make sure you declare your function pointers with the same calling convention as the actual library function. fr fr. your code will crash mysteriously if you do not do this. mysterious crashes are NOT main character energy, they're just chaos. 😭
  • if the requested function doesn't exist, NULL is returned. simple as that. πŸ“

🌈 FUNCTION PARAMETERS 🌈

  • handle β€” a valid shared object handle returned by SDL_LoadObject(). gotta be valid, bestie, we're not doing vibes-based handles here. ✨
  • name β€” the name of the function to look up. yes, the actual name. as a string. 🌸

⭐ RETURN VALUE ⭐

returns a pointer to the function, or NULL on failure. and if you get NULL? call SDL_GetError() for more information, she'll tell you what went wrong. 🫢


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. periodt. go wild, queen. πŸ‘‘


πŸ’œ AVAILABILITY πŸ’œ

this function is available since SDL 3.2.0. if you're on something older, sorry babe. πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page!! πŸ¦‹βœ¨ this one came to you from Simple Directmedia Layer, straight out of SDL 3.4.18, and she's the SDL_LoadFunction(3) girlie we all know and love. mwah. πŸ’–πŸ’…πŸŽ€

πŸ“¦ where this page comes from