It's pretty straightforward, if not entirely well documented. Reading the source (not sure if the released version differs significantly) tells me that you must export an environment variable SDL_DYNAMIC_API
with the name of the .so you want to load. That .so must contain a symbol SDL_DYNAPI_entry
with signature: Sint32(SDLCALL*)(Uint32 apiver, void *table, Uint32 tablesize)
. If the library exists and the symbol exists, it will be loaded and the function called.
A combination of apiver
(which is equal to SDL_DYNAPI_VERSION
) and tablesize
(roughly the number of dynamic functions) can be used to fill in the table at table
. The apiver
will only change if the ABI changes in a non-compatible way. The tablesize
may grow, but hypothetically this is ok: it just means that the SDL library has new dynamic functions that you don't have to care about and you can safely only update the parts of table
you already know about. The function should return non-zero on success and zero on failure.
The current code doesn't actually do anything on failure. It just carries on like nothing happened, so essentially SDL will just work like normal.