|
rlib
Convenience library for useful things
|
Open shared libraries at runtime, resolve exported symbols and walk named sections. More...
Typedefs | |
| typedef rpointer | RMODULE |
| Opaque module handle returned by r_module_open. | |
Enumerations | |
| enum | RModuleError { R_MODULE_ERROR_OK = 0 , R_MODULE_ERROR_NOT_FOUND } |
| Result of r_module_open. More... | |
Functions | |
| RMODULE | r_module_open (const rchar *path, rboolean lazy, RModuleError *err) |
Open the shared library at path. | |
| rpointer | r_module_lookup (RMODULE mod, const rchar *sym) |
Resolve symbol sym in mod. | |
| void | r_module_close (RMODULE mod) |
Close mod and release any backing OS resources. | |
| rpointer | r_module_find_section (RMODULE mod, const rchar *name, rssize nsize, rsize *secsize) |
Locate a named section within mod's loaded image. | |
Open shared libraries at runtime, resolve exported symbols and walk named sections.
The implementation maps onto dlopen / dlsym / dlclose on Unix and LoadLibrary / GetProcAddress / FreeLibrary on Windows.
| enum RModuleError |
Result of r_module_open.
| Enumerator | |
|---|---|
| R_MODULE_ERROR_OK | Module loaded successfully. |
| R_MODULE_ERROR_NOT_FOUND | File missing or could not be loaded. |
Locate a named section within mod's loaded image.
Useful for embedding read-only data tables and reaching them by section name (e.g. ELF .rodata.foo, Mach-O __DATA,foo, PE .rdata$foo) without exporting a symbol.
| mod | Module handle. |
| name | Section name. |
| nsize | Length of name in bytes, or -1 for strlen. |
| secsize | Out-pointer that receives the section's byte size. |
NULL if absent. Resolve symbol sym in mod.
NULL if unresolved. | RMODULE r_module_open | ( | const rchar * | path, |
| rboolean | lazy, | ||
| RModuleError * | err | ||
| ) |
Open the shared library at path.
| path | Filesystem path to a .so / .dylib / .dll. |
| lazy | TRUE for lazy symbol binding (RTLD_LAZY), FALSE for eager (RTLD_NOW). |
| err | Optional out-pointer that receives a RModuleError code. |
NULL on failure (see err).