将c ++ / Cx代码与旧版c ++混合使用? [英] Mixing c++/Cx code with legacy c++?

查看:147
本文介绍了将c ++ / Cx代码与旧版c ++混合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Windows运行时组件DLL并导入了大量旧版C ++。  WRC dll中的所有c ++文件都使用Consume Runtime Extension进行编译:"Yes(/ ZW)"。


从传统的C ++模块中,我需要能够引用使用C ++ / CX扩展语法编译的类:



       公共引用类WASAPIManager密封


遗留的c ++和c ++ / Cx可以在同一个命名空间中共存,还是无关紧要?


什么是从遗留C ++模块创建WASAPIManager类的新实例的正确方法是什么?


任何链接,引用和建议都会受到欢迎。

解决方案

C ++ / Cx和标准C ++在同一模块中共存是很常见的。 C ++ / Cx经常用于类的边界,而标准C ++用于类的主体。


如果你想从C ++而不是C ++ / Cx中使用ref类,那么你通常会使用

Windows运行时C ++模板库(WRL)




I have created a Windows Runtime Component DLL and imported a large chunk of legacy C++.  All of the c++ files in the WRC dll are compiled with the Consume Runtime Extension: "Yes (/ZW)".

From within a legacy C++ module, I need to be able to reference a class compiled with the C++/CX extension syntax:

        public ref class WASAPIManager sealed

Can legacy c++ and c++/Cx co-exist in the same Namespace or does it not matter?

What would be the correct way to create a new instance of the WASAPIManager class from a legacy C++ module?

Any links, references, suggestions would be appreciate.

解决方案

It is common for C++/Cx and standard C++ to coexist in the same module. C++/Cx is often used on the boundaries of a class and standard C++ for the body of the class.

If you want to consume a ref class from C++ rather than from C++/Cx then you would typically use the Windows Runtime C++ Template Library (WRL).


这篇关于将c ++ / Cx代码与旧版c ++混合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆