|
infix
A JIT-Powered FFI Library for C
|
Implements cross-platform dynamic library loading. More...
Go to the source code of this file.
Functions | |
| c23_nodiscard infix_library_t * | infix_library_open (const char *path) |
| Opens a dynamic library and returns a handle to it. | |
| void | infix_library_close (infix_library_t *lib) |
| Closes a dynamic library handle and frees associated resources. | |
| c23_nodiscard void * | infix_library_get_symbol (infix_library_t *lib, const char *symbol_name) |
| Retrieves the address of a symbol (function or variable) from a loaded library. | |
| c23_nodiscard infix_status | infix_read_global (infix_library_t *lib, const char *symbol_name, const char *type_signature, void *buffer, infix_registry_t *registry) |
| Reads the value of an exported global variable from a library into a buffer. | |
| c23_nodiscard infix_status | infix_write_global (infix_library_t *lib, const char *symbol_name, const char *type_signature, void *buffer, infix_registry_t *registry) |
| Writes data from a buffer into an exported global variable in a library. | |
Implements cross-platform dynamic library loading.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
This module provides a platform-agnostic API for opening shared libraries (.dll, .so, .dylib), looking up symbols within them, and reading or writing to exported global variables. It abstracts away the differences between the Windows API (LoadLibrary, GetProcAddress) and the POSIX API (dlopen, dlsym).
The functions infix_read_global and infix_write_global combine this dynamic loading capability with the infix type system to safely interact with global variables of any type described by a signature string.