infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
Dynamic Library API

Functions for loading shared libraries and looking up symbols. More...

Collaboration diagram for Dynamic Library API:

Functions

c23_nodiscard infix_library_tinfix_library_open (const char *)
 Opens a dynamic library and returns a handle to it.
 
void infix_library_close (infix_library_t *)
 Closes a dynamic library handle and unloads it.
 
c23_nodiscard void * infix_library_get_symbol (infix_library_t *, const char *)
 Retrieves the memory address of a symbol (function or global variable).
 

Detailed Description

Functions for loading shared libraries and looking up symbols.

Function Documentation

◆ infix_library_close()

void infix_library_close ( infix_library_t lib)

Closes a dynamic library handle and unloads it.

Parameters
libA handle to a previously opened library. Can be nullptr.

◆ infix_library_get_symbol()

c23_nodiscard void * infix_library_get_symbol ( infix_library_t lib,
const char *  symbol_name 
)

Retrieves the memory address of a symbol (function or global variable).

Parameters
libA handle to a previously opened library.
symbol_nameThe name of the symbol to look up.
Returns
A void* pointer to the symbol's address, or nullptr if not found.

◆ infix_library_open()

c23_nodiscard infix_library_t * infix_library_open ( const char *  path)

Opens a dynamic library and returns a handle to it.

Parameters
pathThe file path to the dynamic library (.so, .dll, .dylib).
Returns
A handle to the library on success, or nullptr on failure.
Note
The returned handle must be freed with infix_library_close.