6

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

Since also we support the MAC, I'd like to 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 should add that the c# code we wish to call is not ours. We have no way of making any changes to it. The c++ code, of course, is ours.

4

1 回答 1

1

最简单的方法是通过函数指针公开功能。.Net 和本机代码都可以以函数指针的形式与 C/C++ 代码互操作。运行 C++ 代码的所有平台都支持函数指针,因此可以在不了解 .Net 的情况下编写它。

于 2012-04-26T15:48:02.437 回答