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