How to wrap MFC extension DLL using managed C++

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.
 
A

Atul

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
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top