获取linux下动态库加载时的绝对路径
来源:互联网 发布:ipad发展 知乎 编辑:程序博客网 时间:2024/06/06 00:24
dladdrCFind the shared object that contains a given address
This function finds the shared object that contains a given address.
http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=/com.ibm.ztpf-ztpfdf.doc_put.cur/gtpc2/cpp_dladdr.html
dladdrCFind the shared object that contains a given address
This function finds the shared object that contains a given address.
Last updated
Added for PUT05.
Format
#include <dlfcn.h>
int *dladdr(void *addr, Dl_info *info);info
The z/TPF system returns the following in the D1_info structure:
The name of the shared object.
The load address of that shared object.
The name of the function or NULL if it is not found.
The address of the function or NULL if it is not found.
Examples
This example finds the shared object that contains a given address.
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dlfcn.h>
void identify_function_ptr( void *func) {
Dl_info info;
int rc;
rc = dladdr(func, &info);
if (!rc) {
printf("Problem retrieving program information for %x: %s\n", func, dlerror());
}
printf("Address located in function %s within the program %s\n", info.dli_fname, info.dli_sname);
}Related information
dlcloseCClose a shared object
dlerrorCGet information about dynamic link errors
dlopenCOpen a shared object
dlsymCGet the address of a symbol from a shared object.
See z/TPF C functions overview for more information about z/TPF C/C++ language support.
Parent topic: z/TPF C functions
Previous topic: detac_idCDetach a working storage block from the ECB
Next topic: dlaycCDelay processing of current entry
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void identify_function_ptr( void *func) {
Dl_info info;
int rc;
rc = dladdr(func, &info);
if (!rc) {
printf("Problem retrieving program information for %x: %s\n", func, dlerror());
}
printf("Address located in function %s within the program %s\n", info.dli_fname, info.dli_sname);
}
Address located in function /usr/lib/libm.so within the program cosf
- 获取linux下动态库加载时的绝对路径
- 获取linux下动态库加载时的绝对路径
- linux下获取进程绝对路径的方法
- linux 下获取程序的绝对路径
- Linux下获取当前程序的绝对路径
- Linux下动态加载库的实例
- windows linux 下,获取java项目绝对路径的方法
- Linux下程序(进程)如何获取自身的绝对路径
- Linux Shell下获取当前脚本的绝对路径
- Linux下获取程序绝对路径(全路径)的方法
- 使用linux命令获取文件夹下所有文件的绝对路径
- windows linux 下,获取java项目绝对路径的方法
- 在js文件中获取本身加载时的绝对路径
- linux 获取文件的绝对路径
- Linux下动态加载库
- linux下加载动态库
- linux下获取程序当前目录绝对路径
- linux下获取程序当前目录绝对路径
- android edittext 输入长度限制并提示
- RFC Programming in ABAP
- layout中设置图片自适应大小,并且设置最大宽高
- 图片插入EditView中
- 工厂模式
- 获取linux下动态库加载时的绝对路径
- javascript数组
- Android有效解决加载大图片时内存溢出的问题
- 修改及查看mysql数据库的字符集
- 一些常见的距离与一些常用的measure
- Linux Kickstart无人值守安装
- 再谈Javascript中function fn(){}和var fn=function(){}
- android应用程序皮肤
- Javascript 对字符串,数组的操作