The sample code is as follows:
void *handle = NULL; // Library handle
Location_ResultCode (*OH_Location_StartLocating_Test)(const Location_RequestConfig *); // Function pointer
OH_Location_StartLocating_Test = NULL;
handle = dlopen("liblocation_ndk.so", RTLD_LAZY);
if (handle != NULL) {
OH_Location_StartLocating_Test =
(Location_ResultCode(*)(const Location_RequestConfig *))dlsym(handle, "OH_Location_StartLocating");
if (OH_Location_StartLocating_Test != NULL) {
OH_LOG_INFO(LOG_APP, "OH_Location_StartLocating != NULL");
} else {
OH_LOG_INFO(LOG_APP, "OH_Location_StartLocating = NULL");
}
} else {
OH_LOG_INFO(LOG_APP, "handle = NULL");
}