函数指针的函数名称 [英] function name from function pointer

查看:82
本文介绍了函数指针的函数名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以从函数指针获取函数名称。我在linux上使用

gcc编译器




谢谢


is it possible to get function name from function pointer. I am using
gcc compiler
on linux.

thanks

推荐答案

sinbad写道:
sinbad wrote:

hi,

是否可以从函数指针获取函数名称。我在linux上使用

gcc编译器



is it possible to get function name from function pointer. I am using
gcc compiler
on linux.



是的,但不是标准的C.尝试一下Linux group,或comp.unix.programmer。


-

Ian Collins

Yes, but not in standard C. Try a Linux group, or comp.unix.programmer.

--
Ian Collins


On 2008年11月11日6:15,sinbad写道:
On 11 Nov 2008 at 6:15, sinbad wrote:

是否可以从函数指针获取函数名称。我在linux上使用

gcc编译器。
is it possible to get function name from function pointer. I am using
gcc compiler on linux.



是:man dladdr。你可能需要给gcc -dynamic标志给

让链接器导出一个完整的符号表。

Yes: man dladdr. You''ll probably need to give gcc the -rdynamic flag to
get the linker to export a full symbol table.


11月11日下午3:46 *,Antoninus Twink< nos ... @ nospam.invalidwrote:
On Nov 11, 3:46*pm, Antoninus Twink <nos...@nospam.invalidwrote:

2008年11月11日* 6:15, sinbad写道:
On 11 Nov 2008 at *6:15, sinbad wrote:

是否可以从函数指针获取函数名称。我在linux上使用

gcc编译器。
is it possible to get function name from function pointer. I am using
gcc compiler on linux.



是:man dladdr。你可能需要给gcc -rdynamic标志给

让链接器导出一个完整的符号表。


Yes: man dladdr. You''ll probably need to give gcc the -rdynamic flag to
get the linker to export a full symbol table.





您可以使用%pf打印函数指针地址,然后查看

up for the同样在nm给出的对象表中。

HTH,


Deepak.P

Hi,
You can print the function pointers address using %pf and then look
up for the same in the object table given by nm.
HTH,

Deepak.P


这篇关于函数指针的函数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆