我们的项目结构是这样的,
native.dll
:- 这包含用 c\c++ 编写的纯本机代码。
这个native.dll使用*def文件公开一些函数。
Wrapper Library(wrapper.dll compiled with .Net framework v4.0)
:-
为了使用的功能native.dll
, a Wrapper lib(wrapper.dll)
写在C++\CLI
using :clr\oldsyntax
。这个包装有所有
的代码Interoperability
and 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) 运行时环境 ?
如果不是,该应用程序的可能解决方案是什么?
.Net Core(CoreCLR)是否支持C++\CLI (clr\oldsyntax)运行环境?
据我所知有没有计划通过 .NET Core 支持 C++/CLI https://github.com/dotnet/coreclr/issues/659.
如果不是,该应用程序的可能解决方案是什么?
您可以(应该)提供 C API。单声道 e. G。支持P/Invoke http://www.mono-project.com/docs/advanced/pinvoke/ and .NET Core 还支持 P/Invoke https://jeremylindsayni.wordpress.com/2017/05/01/using-pinvoke-with-net-core-2-and-windows-10-iot-core-on-the-raspberry-pi-3/(也可以看看这个堆栈溢出问题 https://stackoverflow.com/questions/38202027/p-invoke-in-net-core-with-linux and 此 DllMap 相关票证 https://github.com/dotnet/coreclr/issues/930).
更新(2022-09-02):这个答案来自2016。请参阅其他答案(例如,this https://stackoverflow.com/a/73332218/3054219)了解最新 .Net Core 版本的可能性。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)