如何在托管代码中使用c ++ 17模块?

编程入门 行业动态 更新时间:2024-10-19 08:43:57
本文介绍了如何在托管代码中使用c ++ 17模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想从托管的clr / c ++代码中使用c ++ 17模块。可能吗? 我尝试过的事情: 我有用c ++模块构建了一个dll。在没有转动/ clr的情况下从控制台应用程序中消耗它。一切正常。一旦我打开/ clr开关,它就不起作用。 我的clr控制台应用程序有以下命令行选项。 / experimental:module / module:reference $(IntDir)\ mod.ifc 这个是我看到的错误 D8016'/ clr'和'/ experimental:module'命令行选项不兼容ConsoleApplication2

I want to consume c++17 modules from managed clr/c++ code. Is it possible? What I have tried: I have built a dll with c++ modules. Consumed it from a console application without turning /clr. Everything worked. Once i turn on /clr switch, it does not work. My clr console application has the following command line options. /experimental:module /module:reference $(IntDir)\mod.ifc This is the error i am seeing D8016 '/clr' and '/experimental:module' command-line options are incompatible ConsoleApplication2

推荐答案

(IntDir)\ mod.ifc 这是我看到的错误 D8016'/ clr'和'/ experimental:module '命令行选项不兼容ConsoleApplication2 (IntDir)\mod.ifc This is the error i am seeing D8016 '/clr' and '/experimental:module' command-line options are incompatible ConsoleApplication2

有很多方法可以做到这一点: 1.将C ++ 17实现为DLL并导出C函数接口。谷歌有很多材料如何从CLR或.Net langs调用DLL。 2.实现为COM DLL。这个可以被任何语言调用VB,C#,C ++,C等 3.实现为COM EXE服务器。这个可以被任何语言调用,它可以构建为32位,可以从64位进程调用。反之亦然。它被称为进程外服务器。 4.将其实现为Windows服务并通过RPC调用它。例如命名管道或TCP。 5.将其实现为普通exe并再次通过RPC等调用。 There are many ways you can do that: 1. Implement your C++ 17 as DLL and export "C" function interface. There are ton of material on google how to call DLLs from CLR or .Net langs. 2. Implement as COM DLL. This one can be called by any language VB, C#, C++, C etc 3. Implement as COM EXE server. This one can be called by any language plus it can be built as 32 bit and can be called from 64 bit process. And vice versa. It is known as an out of process server. 4. Implement it as windows service and call it via RPC. Named pipes, or TCP for example. 5. Implement it as a normal exe and call via RPC etc again.

更多推荐

如何在托管代码中使用c ++ 17模块?

本文发布于:2023-11-29 20:26:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647535.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   代码   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!