opening shared lib with dlopen, gets success, but dlsym returns an error saying undefined symbol, also passing "-rdynamic" during linking this shared lib, any idea?. dlopen success, dlsym gets error, also when I do nm on this shared lib, I can see symbol, this is standalone lib, not linked with executable.
if ((handle = dlopen(libname, RTLD_NOW)) == NULL) {
printf("ERROR: cannot load library: %s, %s\n", libname, dlerror());
exit(1) ;
} else {
ret = dlsym(handle, func_name);
if ((error = dlerror()) != NULL) {
printf("ERROR: load condition function(%s) failed in %s: error:%s\n",
func_name, libname, error );
exit(1);
}
}