SDL_OpenIO(3)

πŸ’– SDL_OpenIO(3) πŸ’–

okay so bestie, this is a page from the SDL3 FUNCTIONS collection, and it's literally all about building your own SDL_IOStream from scratch. main character energy fr fr πŸŽ€


✨ NAME ✨

SDL_OpenIO β€” Create a custom SDL_IOStream.


✨ SYNOPSIS ✨

#include <SDL3/SDL_iostream.h>

SDL_IOStream * SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata);

✨ DESCRIPTION ✨

so here's the tea πŸ«– β€” normal apps do not need to use this function unless they're out here providing their own SDL_IOStream implementation. like, if you just want an SDL_IOStream to read/write from a common data source, pls pls pls just use the built-in implementations in SDL instead, like SDL_IOFromFile() or SDL_IOFromMem(), etc. those ones ate and left no crumbs πŸ’…

and important detail bestie, don't miss this: this function makes a copy of iface, so the caller does not need to keep it around after this call. you can literally let it go, it's fine, she's independent now πŸ‘‘


✨ FUNCTION PARAMETERS ✨

  • iface β€” the interface that implements this SDL_IOStream, initialized using SDL_INIT_INTERFACE(). πŸ¦‹
  • userdata β€” the pointer that will be passed to the interface functions.

✨ RETURN VALUE ✨

Returns a pointer to the allocated memory on success 🌸 or NULL on failure 😭. and if it fails, go 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. no cap, go wild, thread-safe queen πŸ‘‘


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. ⭐


✨ SEE ALSO ✨


ngl bestie, if you're reaching for this one you're doing something kinda advanced and I'm obsessed with that for you πŸ’– just remember: built-ins first, custom implementations second, and never forget to close your streams. πŸŽ€

k bye ily, this page came to you from Simple Directmedia Layer, version SDL 3.4.18, tagged SDL_OpenIO(3) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from