SDL_OpenStorage(3)

πŸ’– SDL_OpenStorage πŸ’–

okay bestie, welcome to the SDL_OpenStorage(3) page from the SDL3 FUNCTIONS collection πŸŽ€ this one's a lil niche but it's lowkey iconic if you're out here building your own storage backend, so let's get into it ✨


🌸 NAME 🌸

SDL_OpenStorage β€” opens up a container using a client-provided storage interface 🫢


✨ SYNOPSIS ✨

#include <SDL3/SDL_storage.h>

SDL_Storage * SDL_OpenStorage(const SDL_StorageInterface *iface, void *userdata);

πŸ’… DESCRIPTION πŸ’…

so here's the tea β˜• β€” you do NOT need this function unless you're literally providing your own SDL_Storage implementation. like, if all you want is an SDL_Storage, pls just use the built-in implementations that SDL already ships, like SDL_OpenTitleStorage() or SDL_OpenUserStorage(). they exist, they're right there, use them πŸ’–

the way this function works: it makes a copy of iface 🫢 so the caller does not need to keep it around after this call. you can let it go, bestie. it's safe. no cap.


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • iface β€” the interface that implements this storage, initialized using SDL_INIT_INTERFACE(). yes, you gotta init it properly, don't skip that step πŸ‘‘
  • userdata β€” the pointer that will be passed to the interface functions. it just gets handed along, like a lil note you pass in class πŸ“

πŸŽ€ RETURN VALUE πŸŽ€

Returns a storage container on success 🌈 or NULL on failure 😭 β€” and if you get that NULL, call SDL_GetError() for more information, fr fr. always check your errors, it's giving responsible dev energy.


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older… girl, upgrade πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie πŸ’œ this one came to you courtesy of Simple Directmedia Layer, version SDL 3.4.18 β€” mwah, go build something cute with it πŸ§šβœ¨πŸ’–

πŸ“¦ where this page comes from