FPL has built-in support for loading dynamic libraries (.dll/.so).
Loading a dynamic library
To load a dynamic library, such as .dll or .so you simply call fplDynamicLibraryLoad() with the name of the library or the full path.
}
fpl_platform_api bool fplDynamicLibraryLoad(const char *libraryFilePath, fplDynamicLibraryHandle *outHandle)
Loads a dynamic library and returns if the load was successful or not.
fpl_platform_api void fplDynamicLibraryUnload(fplDynamicLibraryHandle *handle)
Unloads the loaded library and resets the handle to zero.
A structure containing the internal handle to a dynamic library.
- Note
- Call fplDynamicLibraryUnload() to unload a loaded library when you are done.
Getting a procedure address
To get a procedure address from a function inside a library, simply call fplGetDynamicLibraryProc() .
typedef int(fn_LengthSquared)(int a, int b);
int len = lenSqFunc(3, 6);
}
fpl_platform_api void * fplGetDynamicLibraryProc(const fplDynamicLibraryHandle *handle, const char *name)
Returns the dynamic library procedure address for the given procedure name.