- 论坛徽章:
- 0
|
int dev_func(char dev_func_name[])
{
int res;
void *handle;
int (*func)();
char *error;
handle = dlopen(dev_lib_path, RTLD_LAZY);
if(!handle) {
LOG(m_event, ERROR, "%s\n", dlerror());
return FAIL;
}
func = dlsym(handle, dev_func_name);
if((error = dlerror()) != NULL) {
LOG(m_event, ERROR, "%s\n", error);
dlclose(handle);
return FAIL;
}
res = (*func)();
//if (res != -1) {
// LOG(m_event, DEBUG, "Call dll device func success.\n");
dlclose(handle);
return res;
/* }
dlclose(handle);
LOG(m_event, ERROR, "Call dll device func failed.\n");
return FAIL;*/
}
|
如上函数,其中 func = dlsym(handle, dev_func_name);
res = (*func)();
| 两处不懂,还请各位指教
此函数的返回值与dev_func_name函数的返回值有关系吗? |
|