30#if defined(INFIX_OS_WINDOWS)
52#if defined(INFIX_OS_WINDOWS)
54 if (path ==
nullptr) {
55 lib->
handle = GetModuleHandleA(path);
56 lib->is_pseudo_handle =
true;
59 lib->
handle = LoadLibraryA(path);
60 lib->is_pseudo_handle =
false;
68 lib->
handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
70 if (lib->
handle ==
nullptr) {
71#if defined(INFIX_OS_WINDOWS)
94#if defined(INFIX_OS_WINDOWS)
97 if (!lib->is_pseudo_handle)
98 FreeLibrary((HMODULE)lib->
handle);
122 if (lib ==
nullptr || lib->
handle ==
nullptr || symbol_name ==
nullptr)
124#if defined(INFIX_OS_WINDOWS)
125 return (
void *)GetProcAddress((HMODULE)lib->
handle, symbol_name);
127 return dlsym(lib->
handle, symbol_name);
148 const char * symbol_name,
149 const char * type_signature,
152 if (buffer ==
nullptr)
155 if (symbol_addr ==
nullptr) {
190 const char * symbol_name,
191 const char * type_signature,
194 if (buffer ==
nullptr)
197 if (symbol_addr ==
nullptr) {
infix_arena_t * arena
Definition 005_layouts.c:60
infix_registry_t * registry
Definition 008_registry_introspection.c:32
infix_status status
Definition 103_unions.c:59
#define c23_nodiscard
A compatibility macro for the C23 [[nodiscard]] attribute.
Definition compat_c23.h:106
@ INFIX_CODE_SYMBOL_NOT_FOUND
Definition infix.h:1247
@ INFIX_CODE_LIBRARY_LOAD_FAILED
Definition infix.h:1248
@ INFIX_CODE_OUT_OF_MEMORY
Definition infix.h:1228
@ INFIX_CATEGORY_ALLOCATION
Definition infix.h:1216
@ INFIX_CATEGORY_GENERAL
Definition infix.h:1215
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.
Definition loader.c:189
void infix_library_close(infix_library_t *lib)
Closes a dynamic library handle and frees associated resources.
Definition loader.c:90
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.
Definition loader.c:121
c23_nodiscard infix_library_t * infix_library_open(const char *path)
Opens a dynamic library and returns a handle to it.
Definition loader.c:46
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.
Definition loader.c:147
c23_nodiscard infix_status infix_type_from_signature(infix_type **, infix_arena_t **, const char *, infix_registry_t *)
Parses a signature string representing a single data type.
Definition signature.c:1009
size_t size
Definition infix.h:197
infix_status
Enumerates the possible status codes returned by infix API functions.
Definition infix.h:352
@ INFIX_SUCCESS
Definition infix.h:353
@ INFIX_ERROR_INVALID_ARGUMENT
Definition infix.h:355
#define infix_free
A macro that can be defined to override the default free function.
Definition infix.h:301
void infix_arena_destroy(infix_arena_t *)
Destroys an arena and frees all memory allocated from it.
Definition arena.c:83
#define infix_memcpy
A macro that can be defined to override the default memcpy function.
Definition infix.h:305
#define infix_calloc
A macro that can be defined to override the default calloc function.
Definition infix.h:293
Internal data structures, function prototypes, and constants.
void _infix_set_error(infix_error_category_t category, infix_error_code_t code, size_t position)
Sets the thread-local error state with detailed information.
Definition error.c:165
void _infix_set_system_error(infix_error_category_t category, infix_error_code_t code, long system_code, const char *msg)
Sets the thread-local error state for a system-level error.
Definition error.c:234
Internal definition of a memory arena.
Definition infix_internals.h:138
Internal definition of a dynamic library handle.
Definition infix_internals.h:207
void * handle
Definition infix_internals.h:208
Internal definition of a named type registry.
Definition infix_internals.h:165
A semi-opaque structure that describes a C type.
Definition infix.h:194