更新时间:2023-02-09 17:48:54
虽然不是 POSIX 标准接口,dladdr()
函数可用于许多系统,包括 Linux, Solaris, Darwin/Mac OS X,FreeBSD, HP-UX 和 IRIX.这个函数需要一个地址,例如它可以是一个指向模块内静态函数的指针(如果转换为void *
),并用信息填充Dl_info
结构包括包含该地址的共享对象的路径名(在 dli_fname
成员中).
Although it is not a POSIX standard interface, the dladdr()
function is available on many systems including Linux, Solaris, Darwin/Mac OS X, FreeBSD, HP-UX, and IRIX. This function takes an address, which could be a pointer to a static function within the module for example (if cast to void *
), and fills in a Dl_info
structure with information including the path name of the shared object containing that address (in the dli_fname
member).