λ61
Loading...
Searching...
No Matches
loadSharedLibrary.c File Reference
#include "l61/RosettaSystem/loadSharedLibrary.h"
#include <stdio.h>
#include <dlfcn.h>

Functions

l61_rosetta_SharedLibrary_handle_t l61_rosetta_loadSharedLibrary (const char *file)
l61_rosetta_SharedLibrary_symbol_t l61_rosetta_getSharedLibrarySymbol (l61_rosetta_SharedLibrary_handle_t handle, const char *symbol)
int l61_rosetta_unloadSharedLibrary (l61_rosetta_SharedLibrary_handle_t handle)
const char * l61_rosetta_getSharedLibraryLoaderError ()

Function Documentation

◆ l61_rosetta_getSharedLibraryLoaderError()

const char * l61_rosetta_getSharedLibraryLoaderError ( )

Retrieves a description of the last shared library loading error. On POSIX systems, this wraps dlerror(). On Windows, it provides a formatted system error message.

Warning
The returned string is stored in thread-local storage on POSIX systems but uses a static buffer on Windows (not thread-safe on Windows).
Returns
A pointer to a string describing the last error. !!DO NOT FREE!!

◆ l61_rosetta_getSharedLibrarySymbol()

l61_rosetta_SharedLibrary_symbol_t l61_rosetta_getSharedLibrarySymbol ( l61_rosetta_SharedLibrary_handle_t handle,
const char * symbol )

Gets a symbol from a shared library.

Parameters
handleHandle to the loaded library.
symbolName of the symbol to retrieve.
Warning
Do mind C++ symbol mangling
Returns
Pointer to the requested symbol, or NULL if the symbol is not found.

◆ l61_rosetta_loadSharedLibrary()

l61_rosetta_SharedLibrary_handle_t l61_rosetta_loadSharedLibrary ( const char * file)

Loads a shared library.

Parameters
filePath to the library.
Returns
Handle to the loaded library, or NULL on failure.

◆ l61_rosetta_unloadSharedLibrary()

int l61_rosetta_unloadSharedLibrary ( l61_rosetta_SharedLibrary_handle_t handle)

Unloads a shared library.

Parameters
handleHandle to the loaded library.
Returns
0 on success, -1 on failure.