Skip to content

Using Dynamic Libraries

Finalspace edited this page May 29, 2026 · 1 revision

Table of Contents

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.

 libHandle;
if (("mylibrary.dll", &libHandle)) {
    // ... using the library

    // Unload it when you are done
    (&libHandle);
}

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);
 libHandle;
if (("mymathy.dll", &libHandle)) {
    // Get "LengthSquared" raw procedure address
    void *lenSqFuncRaw = (&libHandle, "LengthSquared");

    // Get "LengthSquared" casted procedure address
    fn_LengthSquared *lenSqFunc = (fn_LengthSquared *)(&libHandle, "LengthSquared");

    // Use the procedure like any function pointer
    int len = lenSqFunc(3, 6);

    // Unload it when you are done
    (&libHandle);
}

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally