本文介绍了.Net Core 中的 C++/CLI 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的项目结构是这样的,

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)使用 :clroldsyntaxC++CLI 中编写.这个包装有所有InteroperabilityMarshalling 的代码.

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 allcode 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 providedby native.dll.

现在这个项目需要在 .Net Core 中运行.这意味着我们将有一个.Net Core applicationreference 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 refernative.dll.

我知道这不会直接起作用.但问题是.Net Core(CoreCLR) 是否支持C++CLI (clroldsyntax) 运行环境 ?

I know this will not directly work. But the issue is whether .Net Core(CoreCLR) supportsC++CLI (clroldsyntax) runtime environment ?

如果不是,此应用程序工作的可能解决方案是什么?

推荐答案

据我所知,没有计划通过 .NET Core 支持 C++/CLI.

如果不是,此应用程序工作的可能解决方案是什么?

您可以(应该)提供 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 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 04:05