![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Macros | |
| #define | N_MODULE_ERROR_MAX 512 |
| longest error text kept by n_module_error(), terminator included | |
Functions | |
| int | n_module_close (N_MODULE **module) |
| Close a library and free its handle. | |
| const char * | n_module_error (void) |
| What the system said about this thread's last failed call. | |
| const char * | n_module_extension (void) |
| The file extension shared libraries have on this platform. | |
| N_MODULE * | n_module_open (const char *path) |
| Open a shared library. | |
| void * | n_module_symbol (N_MODULE *module, const char *name) |
| Find a symbol in an opened library. | |
| #define N_MODULE_ERROR_MAX 512 |
longest error text kept by n_module_error(), terminator included
Definition at line 58 of file n_module.h.
Referenced by _n_module_set_error().
| int n_module_close | ( | N_MODULE ** | module | ) |
Close a library and free its handle.
Every address found with n_module_symbol() is invalid afterwards: the system may unmap the library's code.
| module | address of the handle; set to NULL. NULL, or a pointer to NULL, is a no-op. |
Definition at line 136 of file n_module.c.
References _n_module_set_error(), and Free.
Referenced by _a4_midi_shutdown(), and main().
| const char * n_module_error | ( | void | ) |
What the system said about this thread's last failed call.
Definition at line 157 of file n_module.c.
References _n_module_last_error.
Referenced by main().
| const char * n_module_extension | ( | void | ) |
The file extension shared libraries have on this platform.
What a plugin host looks for in a directory: ".dll" on Windows, ".dylib" on macOS, ".so" elsewhere.
Definition at line 161 of file n_module.c.
Referenced by main().
| N_MODULE * n_module_open | ( | const char * | path | ) |
Open a shared library.
path is handed to the system loader as it is: a bare file name is looked up the platform's way (LD_LIBRARY_PATH and the cache on Linux, the program's directory and PATH on Windows), a path with a directory is opened as given. On POSIX the library is opened RTLD_LAZY | RTLD_LOCAL, so its symbols do not leak into the ones the program already has. On Windows path is UTF-8.
| path | library file name or path. Must not be NULL. |
Definition at line 68 of file n_module.c.
References __n_assert, _n_module_last_error, _n_module_set_error(), and Malloc.
Referenced by _a4_fluidsynth_open().
| void * n_module_symbol | ( | N_MODULE * | module, |
| const char * | name ) |
Find a symbol in an opened library.
The address of a function comes back as a void pointer, which C does not define a conversion from; copy it into a function pointer with memcpy, which is what every loader on both platforms relies on.
| module | library from n_module_open(). Must not be NULL. |
| name | symbol name. Must not be NULL. |
Definition at line 110 of file n_module.c.
References __n_assert, _n_module_last_error, _n_module_set_error(), and N_MODULE::handle.
Referenced by _a4_fluidsynth_sym(), and main().