Varangian wrote:
I made an MFC DLL in C++ . I want to reference it in C#.
However I don't know where to put the function to be called from C# ?
After referencing the DLL no methods are visible in the C# object
browser.
Anyone knows please?
Hi Varangian,
would be good if it would be that simple ;-).
I suppose you've created a native Dll and you have 3 options to access
the functions / objects in the MFC Dll.
a) COM Interop - wrap your functions in COM objects.
(Most) COM/ActiveX objects can be accessed directly by C#
b) PInvoke: Export the functions in the dll with
__declspec(dllexport)
and import them with DllImport attribute
c) Create a mixed Dll: due to the "loader lock" problem I would suggest
you to do this only with VC 2005 not with VC 2003.
You can export C++/CLI wrapper objects, which are directly accessible
from C#.
Hope that helps.
Andre