A problem with forwarding an exported function in a DLL
Hi I am forwarding an exported function of a DLL to another function in my DLL. I use ExpX64 for editing the export tabl开发者_JAVA技巧e 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:
__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
I doubt that the error you get has to do anything with the forwarding. The error is STG_E_REVERTED, and that is related to structured storage (which your method appears to be completely unrelated to). The error is apparently particularly frequent in SharePoint applications.
Edit: Structured Storage is a Microsoft API for persistence in COM.
精彩评论