.Net Core 中的 C++/CLI 支持 [英] C++/CLI Support in .Net Core
问题描述
我们的项目结构是这样的,
Our project structure is like,
native.dll
:- 这包含用 cc++ 编写的纯本机代码.这个 native.dll 使用 *def 文件公开了一些函数.
native.dll
:- This contains pure native code written in cc++.
This native.dll exposes some functions using *def file.
Wrapper Library(wrapper.dll 用 .Net framework v4.0 编译)
:-为了使用 native.dll
的功能,需要一个 Wrapper lib(wrapper.dll)
使用 :clroldsyntax
在 C++CLI
中编写.这个包装有所有Interoperability
和 Marshalling
的代码.
Wrapper Library(wrapper.dll compiled with .Net framework v4.0)
:-
In order to use functionality of native.dll
, a Wrapper lib(wrapper.dll)
is written in C++CLI
using :clroldsyntax
. This wrapper has all
code of Interoperability
and Marshalling
.
Application(Console App v4.0)
直接使用 wrapper.dll
来使用提供的功能通过 native.dll
.
Application(Console App v4.0)
directly uses wrapper.dll
to use functionality provided
by native.dll
.
现在这个项目需要在 .Net Core 中运行.这意味着我们将有一个.Net Core application
将 reference wrapper.dll
反过来将引用native.dll
.
Now this project needs to run in .Net Core. This means we will have an
.Net Core application
that will reference wrapper.dll
that in turn will refer
native.dll
.
我知道这不会直接起作用.但问题是.Net Core(CoreCLR) 是否支持C++CLI (clroldsyntax) 运行环境 ?
I know this will not directly work. But the issue is whether .Net Core(CoreCLR) supports C++CLI (clroldsyntax) runtime environment ?
如果不是,此应用程序工作的可能解决方案是什么?
推荐答案
.Net Core(CoreCLR) 是否支持 C++CLI (clroldsyntax) 运行环境?
whether .Net Core(CoreCLR) supports C++CLI (clroldsyntax) runtime environment ?
据我所知,没有计划通过 .NET Core 支持 C++/CLI.
如果不是,此应用程序工作的可能解决方案是什么?
If no, what can be the possible solutions to this application work ?
您可以(应该)提供 C API.单声道 e.G.支持 P/Invoke 和 .NET Core 也支持 P/Invoke(另见 此堆栈溢出问题 和 此 DllMap 相关票证).
You can (should) provide a C API. Mono e. g. supports P/Invoke and .NET Core also supports P/Invoke (see also this Stack overflow question and this DllMap related ticket).
这篇关于.Net Core 中的 C++/CLI 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!