我们的项目结构就像,native.dll
:- 这包含用 c\c++ 编写的纯 native 代码。
这个 native.dll 使用 *def 文件公开了一些函数。Wrapper Library(wrapper.dll compiled with .Net framework v4.0)
:-
为了使用native.dll
的功能, Wrapper lib(wrapper.dll)
写在 C++\CLI
使用 :clr\oldsyntax
.这个包装有所有Interoperability
的代码和 Marshalling
.Application(Console App v4.0)
直接使用wrapper.dll
使用提供的功能
来自 native.dll
.
现在这个项目需要运行在 .Net核心 .这意味着我们将有一个.Net Core application
那将 reference wrapper.dll
反过来会提到native.dll
.
我知道这不会直接起作用。但问题是 .Net Core(CoreCLR) 是否支持
C++\CLI (clr\oldsyntax) 运行时环境 ?
如果不是,此应用程序工作的可能解决方案是什么?
请您参考如下方法:
whether .Net Core(CoreCLR) supports C++\CLI (clr\oldsyntax) runtime environment ?
据我所知有 no plan to support C++/CLI with .NET Core .
If no, what can be the possible solutions to this application work ?
您可以(应该)提供 C API。 Mono e. g. supports P/Invoke和 .NET Core also supports P/Invoke (另见 this Stack overflow question 和 this DllMap related ticket )。