SDL_INIT_INTERFACE(3)

SDL_INIT_INTERFACE3

A macro to initialize an sdl interface.

Usage

#include "SDL3/SDL.h"

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

Header file

Defined in SDL3/SDL_stdinc.h

Overview

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.

From libsdl3-doc 3.2.10+ds-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.