26 RCSIDH(dl_h,
"$Id: 7ab8dc5798d5af68d350a761ceea9882bcd3e355 $")
29 # error FreeRADIUS needs a working dlopen()
33 #include <freeradius-devel/util/dlist.h>
34 #include <freeradius-devel/util/rb.h>
35 #include <freeradius-devel/util/talloc.h>
36 #include <freeradius-devel/util/version.h>
45 # define DL_EXTENSION ".dylib"
47 # define DL_EXTENSION ".dll"
49 # define DL_EXTENSION ".so"
98 unsigned int priority,
char const *symbol,
105 unsigned int priority,
char const *symbol,
static dl_loader_t * dl_loader
fr_dcursor_eval_t void const * uctx
bool in_tree
Whether this dl is registered in the dl_tree.
dl_t * dl_by_name(dl_loader_t *dl_loader, char const *name, void *uctx, bool uctx_free))
Search for a dl's shared object in various locations.
dl_loader_t * dl_loader_init(TALLOC_CTX *ctx, void *uctx, bool uctx_free, bool defer_symbol_init)
Initialise structures needed by the dynamic linker.
dl_loader_t * loader
Loader that owns this dl.
struct dl_s dl_t
Module handle.
int dl_search_path_append(dl_loader_t *dl_loader, char const *lib_dir)
Append a new search path component to the library search path.
int(* dl_onload_t)(dl_t const *module, void *symbol, void *user_ctx)
Callback to call when a module is first loaded.
int dl_search_global_path_set(char const *lib_dir)
Set the global library path.
bool uctx_free
Free opaque data on dl_t free (usually false).
bool dl_loader_set_static(dl_loader_t *dl_loader, bool do_static)
Runtime override for doing static or dynamic module loading.
void * handle
Handle returned by dlopen.
fr_rb_node_t node
Entry in the rbtree module handles.
int dl_search_path_prepend(dl_loader_t *dl_loader, char const *lib_dir)
Append a new search path component to the library search path.
void * dl_open_by_sym(char const *sym_name, int flags)
Utility function to dlopen the library containing a particular symbol.
void * uctx
API client's opaque data.
char const * dl_search_path(dl_loader_t *dl_loader)
Return current library path.
int dl_search_path_set(dl_loader_t *dl_loader, char const *lib_dir)
Set the current library path.
int dl_symbol_init_cb_register(dl_loader_t *dl_loader, unsigned int priority, char const *symbol, dl_onload_t func, void *ctx)
Register a callback to execute when a dl with a particular symbol is first loaded.
int dl_free(dl_t const *dl)
"free" a dl handle, possibly actually freeing it, and unloading the library
void * dl_loader_uctx(dl_loader_t *dl_loader)
Retrieve the uctx from a dl_loader.
int dl_symbol_init(dl_loader_t *dl_loader, dl_t const *dl)
Walk over the registered init callbacks, searching for the symbols they depend on.
void dl_symbol_free_cb_unregister(dl_loader_t *dl_loader, char const *symbol, dl_unload_t func)
Unregister an callback that was to be executed when a dl was unloaded.
void dl_symbol_init_cb_unregister(dl_loader_t *dl_loader, char const *symbol, dl_onload_t func)
Unregister an callback that was to be executed when a dl was first loaded.
void dl_loader_debug(dl_loader_t *dl)
Called from a debugger to print information about a dl_loader.
int dl_symbol_free_cb_register(dl_loader_t *dl_loader, unsigned int priority, char const *symbol, dl_unload_t func, void *ctx)
Register a callback to execute when a dl with a particular symbol is unloaded.
char const * name
Name of the module e.g. sql.
void(* dl_unload_t)(dl_t const *module, void *symbol, void *user_ctx)
Callback when a module is destroyed.