quarks
quarks

Reputation: 35276

Function address

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
}

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.

Upvotes: 0

Views: 487

Answers (2)

Rafael Baptista
Rafael Baptista

Reputation: 11499

if the functions are in the .dll, you can probably export them using a .def file. It creates an export table after the fact from compiled code as if dllexport had been defined.

Read about it here: http://msdn.microsoft.com/en-us/library/d91k01sh(v=vs.80).aspx

Upvotes: 0

James McNellis
James McNellis

Reputation: 354969

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.

Upvotes: 1

Related Questions