diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2019-02-25 13:31:49 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-02-25 16:36:26 -0800 |
commit | a928d60188ff466fce61c2c83e381790c4497426 (patch) | |
tree | 9b800e82b1e962438ddf3185e47d415d00938301 /utils/loc_misc_utils.h | |
parent | d31be6470042dd744a408c207d2b5b7fb7839959 (diff) | |
download | gps-a928d60188ff466fce61c2c83e381790c4497426.tar.gz |
util to get get symbol from a library
Added dlGetSymFromLib() to provide a utility that dlopen()'s
a library, and get the pointer to a symbol name.
Change-Id: I770eaef18a61aaa458833b3ca778f44b299585f5
CRs-Fixed: 2404939
Diffstat (limited to 'utils/loc_misc_utils.h')
-rw-r--r-- | utils/loc_misc_utils.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/loc_misc_utils.h b/utils/loc_misc_utils.h index 7d66d84..fad1b6d 100644 --- a/utils/loc_misc_utils.h +++ b/utils/loc_misc_utils.h @@ -92,6 +92,34 @@ SIDE EFFECTS N/A ===========================================================================*/ void loc_util_trim_space(char *org_string); + +/*=========================================================================== +FUNCTION dlGetSymFromLib + +DESCRIPTION + Handy function to get a pointer to a symbol from a library. + + If libHandle is not null, it will be used as the handle to the library. In + that case libName wll not be used; + libHandle is an in / out parameter. + If libHandle is null, libName will be used to dlopen. + Either libHandle or libName must not be nullptr. + symName must not be null. + +DEPENDENCIES + N/A + +RETURN VALUE + pointer to symName. Could be nullptr if + Parameters are incorrect; or + libName can not be opened; or + symName can not be found. + +SIDE EFFECTS + N/A +===========================================================================*/ +void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName); + #ifdef __cplusplus } #endif |