I’ve got a code snippet of c# that I’ve been trying to translate into vc++, but I’m having some difficulties. So, I’m wondering if it is possible or advisable to mix c# and vc++; that is to say, can I call my c# function from vc++ and vice-versa. If so, are there tricks to it? If, not, why?
Share
Calling C++ code from C# is easy enough and you should be able to find plenty of articles on Pinvoke and other types of interop.
For calling your C# code from C++ – if your C++ app is managed then you should be able to directly reference the C# assembly from your C++ app and use it as normal.
If ypu C++ code is not managed then you will need to use some sort of interop to allow your C++ assembly to call C# code, the only way of doing this that springs to mind is COM.
Try some of these links for more information on COM interop with C#: