C++/CLI Support in .Net Core

User1234 picture User1234 · Aug 25, 2016 · Viewed 19k times · Source

Our project structure is like,

native.dll :- This contains pure native code written in c\c++. This native.dll exposes some functions using *def file.

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 :clr\oldsyntax. This wrapper has all code of Interoperability and Marshalling.

Application(Console App v4.0) directly uses wrapper.dll to use functionality provided by 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.

I know this will not directly work. But the issue is whether .Net Core(CoreCLR) supports C++\CLI (clr\oldsyntax) runtime environment ?

If no, what can be the possible solutions to this application work ?

Answer

Sonic78 picture Sonic78 · Oct 25, 2016

whether .Net Core(CoreCLR) supports C++\CLI (clr\oldsyntax) runtime environment ?

As far as I know there is no plan to support C++/CLI with .NET Core.

If no, what can be the possible solutions to this application work ?

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).