How to wrap MFC extension DLL using managed C++

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to wrap a MFC extension Dll with export class(let's suppose it's
named CA)
so we could use it in C#.
The dll is provided by third party vendor which means I couldn't modify it.
A managed c++ library project was created to wrap this dll with a __gc
class(let's suppose it's named CGA).
class CGA contain an instance of class CA and explicitly delegates
implementation to the CA's methods
The problem is any call to methods of class CA(from the wrap class CGA of
course) would
cause AssertFailure and it's turn out that the function AfxGetInstance
failed with null-pointer returned.
Is there any solution to this problem?

BTW: English is not my mothertongue, so feel free to correct me if I'm wrong.
 
Placing a AFX_MANAGE_STATE(AfxGetStaticModuleState( )); call at the start of
each MFC DLL functions can solve many such problems, but since you don't
have the code to the dll, this method will not work. Try working this out
with the vendor.

-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls
 
Thank Atul, but I afraid that it would be very difficult for me to get the
help from the vendor
Is there any other solution to this problem?
 
Back
Top