Mixing C # and vC ++

I have a piece of C # code that I'm trying to translate to vC ++, but I'm having some difficulties. So I am wondering if it is possible or desirable to mix C # and vC ++; that is, I can call a C # function from vC ++ and vice versa. If so, does she have any tricks? If not, why not?

+2


source to share


3 answers


Calling C ++ code from C # is fairly straightforward and you can find many articles on Pinvoke and other types of interaction.

To call your C # code from C ++ - if your C ++ application is managed, you should be able to directly reference the C # assembly from your C ++ application and use it as usual.

If the ypu C ++ code is not managed, you will need to use some kind of interop for your C ++ assembly to call the C # code, the only way to do this that comes to mind is COM.



Try some of these links for more information on COM interoperability with C #:

0


source


If you want to mix the two, I would start with C # as a base project and then register an unmanaged (C ++) DLL in your C # project . This way you can combine the robustness of a managed managed parent C # application with the speed benefits of C ++ in whatever cpu methods you might have.



0


source


Does VC ++ application work? If so, you can create a C # DLL, use it from your C ++ application, and if you so desire, ILMerge them into one EXE.

0


source







All Articles