sdlOpenIo function

Create a custom SDL_IOStream.

Applications do not need to use this function unless they are providing their own SDL_IOStream implementation. If you just need an SDL_IOStream to read/write a common data source, you should use the built-in implementations in SDL, like SDL_IOFromFile() or SDL_IOFromMem(), etc.

This function makes a copy of iface and the caller does not need to keep it around after this call.

\param iface the interface that implements this SDL_IOStream, initialized using SDL_INIT_INTERFACE(). \param userdata the pointer that will be passed to the interface functions. \returns a pointer to the allocated memory on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_CloseIO \sa SDL_INIT_INTERFACE \sa SDL_IOFromConstMem \sa SDL_IOFromFile \sa SDL_IOFromMem

extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata)

Implementation

Pointer<SdlIoStream> sdlOpenIo(
    Pointer<SdlIoStreamInterface> iface, Pointer<NativeType> userdata) {
  final sdlOpenIoLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlIoStream> Function(
          Pointer<SdlIoStreamInterface> iface, Pointer<NativeType> userdata),
      Pointer<SdlIoStream> Function(Pointer<SdlIoStreamInterface> iface,
          Pointer<NativeType> userdata)>('SDL_OpenIO');
  return sdlOpenIoLookupFunction(iface, userdata);
}