dlerror和dlclose用法

dlclose()

1. 包含头文件 #include<dlfcn.h>

2. 函数定义  int dlclose(void *handle)

dlclose用于关闭指定句柄的动态链接库,只有当此动态链接库的使用计数为0时,才会真正被系统卸载

dlerror()

1. 包含头文件#include<dlfcn.h>

2. 函数定义 const char* dlerror(void);

当动态链接库操作函数执行失败时,dlerror可以返回出错信息,返回值为NULL时表示操作函数执行成功

编译时要注意加 -ldl选项

猜你喜欢

转载自www.cnblogs.com/qianqiannian/p/11762652.html
今日推荐