SDL 3.0
|
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_begin_code.h>
#include <SDL3/SDL_close_code.h>
Go to the source code of this file.
Typedefs | |
typedef struct SDL_SharedObject | SDL_SharedObject |
Functions | |
SDL_SharedObject * | SDL_LoadObject (const char *sofile) |
SDL_FunctionPointer | SDL_LoadFunction (SDL_SharedObject *handle, const char *name) |
void | SDL_UnloadObject (SDL_SharedObject *handle) |
typedef struct SDL_SharedObject SDL_SharedObject |
System-dependent library loading routines.
Shared objects are code that is programmatically loadable at runtime. Windows calls these "DLLs", Linux calls them "shared libraries", etc.
To use them, build such a library, then call SDL_LoadObject() on it. Once loaded, you can use SDL_LoadFunction() on that object to find the address of its exported symbols. When done with the object, call SDL_UnloadObject() to dispose of it.
Some things to keep in mind:
Definition at line 72 of file SDL_loadso.h.
|
extern |
Look up the address of the named function in a shared object.
This function pointer is no longer valid after calling SDL_UnloadObject().
This function can only look up C function names. Other languages may have name mangling and intrinsic language support that varies from compiler to compiler.
Make sure you declare your function pointers with the same calling convention as the actual library function. Your code will crash mysteriously if you do not do this.
If the requested function doesn't exist, NULL is returned.
handle | a valid shared object handle returned by SDL_LoadObject(). |
name | the name of the function to look up. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Dynamically load a shared object.
sofile | a system-dependent name of the object file. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Unload a shared object from memory.
Note that any pointers from this object looked up through SDL_LoadFunction() will no longer be valid.
handle | a valid shared object handle returned by SDL_LoadObject(). |
\threadsafety It is safe to call this function from any thread.