dl动态链接文件函数

这篇博客介绍了如何使用dlfcn.h头文件提供的dlopen, dlsym, dlclose等函数来与动态链接装载机交互,实现了在运行时加载、使用和卸载库的功能。同时,文章提到了在某些体系结构上可能出现的问题以及解决方案。" 113973185,10536206,数据库选型:多核VS多线程,"['数据库技术', '数据库优化', '硬件配置', '数据库架构']
摘要由CSDN通过智能技术生成

名称

dladdr, dlclose, dlerror, dlopen, dlsym, dlvsym - programming interface to dynamic linking loader dladdr,dlclose,dlerror,dlopen的,则dlsym,dlvsym - 编程接口以动态连接装载机

Synopsis简介

#include <dlfcn.h >#包括< dlfcn.h时 >

void *dlopen(const char *filename , int flag );*无效使用dlopen(常量字符* 文件名 ​​,INT 标志);

char *dlerror(void);的char * dlerror(无效);

void *dlsym(void *handle , const char * symbol );无效*对dlsym(无效* 手柄 ,常量字符* 符号 );

int dlclose(void *handle ); dlclose(* 句柄无效);

Link with-ldl .低密度脂蛋白的链接。

Description描述

The four functionsdlopen (), dlsym (), dlclose (),dlerror () implement the interface to the dynamic linking loader.四大功能使用dlopen(),dlsym(),dlclose(),dlerror()实现该接口的动态链接装载机。

dlerror()dlerror()

The functiondlerror () returns a human readable string describing the most recent error that occurred fromdlopen (), dlsym () or dlclose () since the last call todlerror (). dlerror()函数返回一个人类可读的字符串描述最近错误的,自上次调用 dlerror()dlopen()则dlsym() dlclose()发生。 It returns NULL if no errors have occurred since initialization or since it was last called.如果没有错误发生自初始化,因为它是上次调用,它返回NULL。

dlopen()dlopen()的

The functiondlopen () loads the dynamic library file named by the null-terminated stringfilename and returns an opaque "handle" for the dynamic library. dlopen()的函数加载动态库文件,以空结尾的字符串 文件名 ​​命名为动态库,并返回一个不透明的“把手”。 If filename is NULL, then the returned handle is for the main program.如果 文件名 ​​是NULL,那么返回的句柄是主程序。 If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname.如果 文件名 ​​中包含斜线(“/”),然后它被解释为路径(相对或绝对)。 Otherwise, the dynamic linker searches for the library as follows (seeld.so (8) for further details):否则,如下(见库的动态链接器 ld.so (8)为进一步的细节): o Ø

(ELF only) If the executable file for the calling program contains a DT_RPATH tag, and does not contain a DT_RUNPATH tag, then the directories listed in the DT_RPATH tag are searched. (低频),如果调用程序的可执行文件包含DT_RPATH标签,不包含DT_RUNPATH的标签,然后在DT_RPATH标签中列出的目录搜索。

o Ø

If, at the time that the program was started, the environment variableLD_LIBRARY_PATH was defined to contain a colon-separated list of directories, then these are searched.在该计划的启动时间,如果环境变量LD_LIBRARY_PATH定义包含一个冒号分隔的目录列表,那么这些搜索。(As a security measure this variable is ignored for set-user-ID and set-group-ID programs.) (此变量,作为一项安全措施被忽略的set-user-ID和设置组ID方案。)

o Ø

(ELF only) If the executable file for the calling program contains a DT_RUNPATH tag, then the directories listed in that tag are searched. (低频)如果调用程序的可执行文件包含一个DT_RUNPATH标签,然后在该标签中列出的目录搜索。

o Ø

The cache file/etc/ld.so.cache (maintained by ldconfig (8)) is checked to see whether it contains an entry forfilename .缓存文件/ etc / ld.so.cache的 (保持LDCONFIG (8))进行检查,看它是否包含一个文件名 ​​的条目。

o Ø

The directories/lib and /usr/lib are searched (in that order).搜索目录/ lib/ usr / lib目录 (按顺序)。

If the library has dependencies on other shared libraries, then these are also automatically loaded by the dynamic linker using the same rules.如果库有依赖于其他共享库,那么这些也自动加载动态连接器使用相同的规则。 (This process may occur recursively, if those libraries in turn have dep

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值