函数地址 [英] Function address

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

问题描述

假设我有一个这样定义的函数:

Suppose I have a function defined like this:

class Foo() {
  public:
      void bar(MyClass* p, int i, int j, CArray<CArray<int,int>,int> &a);
}

void Foo::bar(MyClass* p, int i, int j, CArray<CArray<int,int>,int> &a){
 // Function body
}

对于Win32应用程序/DLL,这个函数不是导出"的,我怎样才能找到bar的函数地址,获取导出函数的函数地址很容易.但是获取非导出函数的函数地址有点困难.

For a Win32 application/DLL, that this function is not "exported" how can I be able to find the function address of bar, getting the function address of exported function was easy. However getting the function address of non-exported function is a bit hard.

推荐答案

在一般情况下不可能这样做.

It is not possible to do this in the general case.

除其他问题外,如果函数没有导出,那么它可能不存在.优化器可以在调用函数的每个位置内联函数.如果发生这种情况,该函数将没有地址,因为它不存在于模块中.

Among other problems, if the function is not exported, then it may not exist. The optimizer may inline the function at every location where the function is called. If this occurs, the function won't have an address because it won't exist in the module.

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

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