- 确认路径是否正确
- 确认目标文件是否是动态库(用ldd 文件名, 若不能查到文件信息,说明不是动态库文件)
- 找不到标识符号,可以将错误信息打印出来,看看哪个标识符没找到,代码如下:
void * handle = dlopen("./libtest.so", RTLD_LAZY);
if (NULL == handle)
{
printf("dlopen error. msg:%s", dlerror());
}
void * handle = dlopen("./libtest.so", RTLD_LAZY);
if (NULL == handle)
{
printf("dlopen error. msg:%s", dlerror());
}