Hi
I have some existing unmanaged MFC/C++ application in VS2005 and VS2003.
I need to modify these apps to call methods already implemented in an
existing C# class library/assembly (retrofit some new functionality) and
redeploy the application.
From doing some reading on this I believe that creating the C# assembly
to support COM interop. and using the COM class from the MFC app is one
solution.
Another suggestion has been to create a C++/CLI class to wrap the C#
assembly, and then this new library can be used in an unmanaged application.
My questions are - is there any other way to achieve this? Which method
would be best in terms or rework and deployment? Has anyone done this
successfully, or has links to any detailed examples of this?
Thanks in advance.
Jayme Pechan - 26 Mar 2007 16:29 GMT
Supporting COM interop in your C# assembly is the easiest way I can think of
doing this. This is just a flag on the dll build then you can use the
standard #import to create some Smart Pointers to the object. This makes
interfacing to the DLL quite simple from C++. Its been too long since I did
MFC programming to remember how it deals with COM objects so I can't give
any specific advise there. You could also host the CLR and load the DLL in
there. MSDN has some information on how to do this but unless you have no
control over the DLL build, this is probably more trouble than it is worth.
> Hi
>
[quoted text clipped - 17 lines]
>
> Thanks in advance.