-
Notifications
You must be signed in to change notification settings - Fork 3
darnit_dynlib.h
DARNIT_DYNLIB is a handle for a dynamically linked and loaded library.
DARNIT_EXPORT is defined here, which is used as a platform independent way of exporting a function in a dll/so/dylib. Eg.
int DARNIT_EXPORT testapp_dynlib(int b) {- DARNIT_DYNLIB *d_dynlib_open(const char *fname);
- void *d_dynlib_get(DARNIT_DYNLIB *lib, const char *symbol);
- DARNIT_DYNLIB *d_dynlib_close(DARNIT_DYNLIB *lib);
DARNIT_DYNLIB *d_dynlib_open(const char *fname);
Opens a dynamically linked library with filename fname and returns a handle to it.
Arguments
- fname - A relative path to the dynamically linked library to load
Return value Returns NULL on failure. Anything else is a valid handle for the library.
void *d_dynlib_get(DARNIT_DYNLIB *lib, const char *symbol);
Gets the pointer to a symbol in the specified library.
Arguments
- lib - The handle to the library to get the symbol from
- symbol - Name of the symbol to look up
Return value Returns NULL on error. Anything else is a valid pointer to the requested symbol.
DARNIT_DYNLIB *d_dynlib_close(DARNIT_DYNLIB *lib);
Unloads a library and invalidates all of its symbols.
Arguments
- lib - The handle to the library to unload
Return value Returns NULL for compact pointer clearing.