How can I call .NET with C ++ as possibly platform independent

I have a C ++ application from which I want to call .NET (C #) methods. I was going to use C++/CLI , but it is only supported on Windows.

Since we also support MAC, I would call .NET from C ++ in a way that will work on both Windows and Mac (with Mono).

What is the best way to do this?

EDIT: I have to add that the C # code we want to call is not ours. We have no changes. C ++ code, of course, is ours.

+6
source share
1 answer

The easiest way is to open the functionality using a function pointer. Both .Net and native code can interact with C / C ++ code as a function pointer. Function pointers are supported on all platforms where C ++ code works, so it can be written without any understanding of .Net.

+1
source

Source: https://habr.com/ru/post/914243/


All Articles