2.2 KiB
2.2 KiB
Loader API is defined in the common/utils/load_module_shlib.h include file.
int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
- possibly initializes the loader, if it has not been already initialized
- Formats the full shared library path, using the
modnameargument and the loadershlibpathandshlibversionconfiguration parameters. - loads the shared library, using the dlopen system call
- looks for
< modname >_autoinitsymbol, using thedlsymsystem call and possibly call the corresponding function. - looks for
< modname >_checkbuildversymbol, using thedlsymsystem call and possibly calls the corresponding function. If the return value of this call is-1, program execution is stopped. It is the responsibility of the shared library developer to implement or not a< modname >_checkbuildverfunction and to decide if a version mismatch is a fatal condition. The< modname >_checkbuildverfunction must match thecheckverfunc_tfunction type. The first argument is the main executable version, as set in thePACKAGE_VERSIONmacro defined in the oai CMakeLists, around line 218. The second argument points to the shared library version which should be set by the< modname >_checkbuildverfunction. - If the farray pointer is null, looks for
< modname >_getfarraysymbol, calls the corresponding function when the symbol is found.< modname >_getfarraytakes one argument, a pointer to aloader_shlibfunc_tarray, and returns the number of items in this array, as defined by thegetfarrayfunc_ttype. Theloader_shlibfunc_tarray returned by the shared library must be fully filled (bothfnameandfptrfields). - looks for the
numffunction symbols listed in thefarray[i].fnamearguments and set the correspondingfarray[i].fptrfunction pointers
void * get_shlibmodule_fptr(char *modname, char *fname)
Returns a pointer to the symbol fname, defined in module modname, or NULL if the symbol is not found.