SDL_INIT_INTERFACE - Man Page

A macro to initialize an SDL interface.

Synopsis

#include <SDL3/SDL_stdinc.h>

#define SDL_INIT_INTERFACE(iface)               \
    do {                                        \
        SDL_zerop(iface);                       \
        (iface)->version = sizeof(*(iface));    \
    } while (0)

Description

This macro will initialize an SDL interface structure and should be called before you fill out the fields with your implementation.

You can use it like this:

SDL_IOStreamInterface iface;

SDL_INIT_INTERFACE(&iface);

// Fill in the interface function pointers with your implementation
iface.seek = ...

stream = SDL_OpenIO(&iface, NULL);

If you are using designated initializers, you can use the size of the interface as the version, e.g.

SDL_IOStreamInterface iface = {
    .version = sizeof(iface),
    .seek = ...
};
stream = SDL_OpenIO(&iface, NULL);

Thread Safety

It is safe to call this macro from any thread.

Availability

This macro is available since SDL 3.2.0.

See Also

SDL_IOStreamInterface(3type), SDL_StorageInterface(3type), SDL_VirtualJoystickDesc(3type)

Referenced By

SDL_IOStreamInterface.3type(3), SDL_OpenIO(3), SDL_OpenStorage(3), SDL_StorageInterface.3type(3), SDL_VirtualJoystickDesc.3type(3).

SDL 3.2.16 Simple Directmedia Layer SDL3 FUNCTIONS