PDA

View Full Version : A problem with forwarding an exported function in a DLL


mehdi311ggg
December 18th, 2010, 05:25
Hi
I am forwarding an exported function of a DLL to another function in my DLL. I use ExpX64 for editing the export table of the DLL.
(for example I forward the ?MyFunc@MyClass@@SAJJAEAUMyStruct@@@Z to myDLL.?MyFunc@MyClass@@SAJJAEAUMyStruct@@@Z)
My problem is that my target function is a member of a class and in runtime, forwarding that generates a COMException ("attempted to use an object that has ceased to exist"
What do you think I'm doing wrong? (Calling conventions? And there should be a difference between forwarding a regular function and a class-member one.)
I implement MyFunc like this:

Code:
__declspec(dllexport) LONG MyClass::MyFunc (long a,struct MyStruct& b)


ps: I can also use a DLL proxy (create a proxy DLL that implements the target function I want and forward all other functions to the original DLL, but the problem that my function is part of a class, still remains)

Thanks

aqrit
December 18th, 2010, 14:34
as in your other post
http://stackoverflow.com/questions/4477668/a-problem-with-forwarding-an-exported-function-in-a-dll
export forwarding is not a cause of this error