简体   繁体   English

Windows 8 WinRT - C ++或C ++ .NET?

[英]Windows 8 WinRT - C++ or C++ .NET?

我听说Windows 8开发将允许XAML / HTML5 + C ++应用程序,但它是原生非托管C ++还是托管C ++(以前称为C ++ .NET)?

The Windows Runtime (WinRT) is itself a native unmanaged framework, but can be called from managed .NET languages in easy way (compared to other native libraries and the infamous P/Invoke ). Windows运行时(WinRT)本身就是一个本机非托管框架,但可以通过简单的方式从托管.NET语言中调用(与其他本机库和臭名昭着的P/Invoke )。

But besides using it from managed languages it can also be called from C++/CX. 但除了从托管语言使用它之外,它还可以从C ++ / CX调用。 This is a Microsoft extension of standard C++ similar to .NET's C++/CLI. 这是标准C ++的Microsoft扩展,类似于.NET的C ++ / CLI。 But in contrast to the latter it is entirely native unmanaged C++. 但与后者相反,它完全是原生的非托管C ++。 But it supports some of C++/CLI's extensions, like the ^ operator for "managed-like" pointers. 但它支持一些C ++ / CLI的扩展,比如“类似托管”指针的^运算符。 But under the hood those are not actually managed garbage collected pointers, but native reference-counted pointers, similar to say a std::shared_ptr . 但在引擎盖下,那些实际上不是托管垃圾收集指针,而是本机引用计数指针,类似于std::shared_ptr And it also supports .NET-like properties and delegates, I think, as well as partial classes in order to work with WinRT 's XAML framework. 我认为它还支持类似.NET的属性和委托,以及部分类,以便使用WinRTXAML框架。

Besides that you can even use WinRT from standard C++ using the so-called Windows Runtime C++ Template Library (WRL) , though it is said to be more-cumbersome than with C++/CX and you may not be able to use all features, like easy XAML interfacing, not sure about that. 除此之外,您甚至可以使用所谓的Windows运行时C ++模板库(WRL)从标准C ++中使用WinRT ,尽管据说它比C ++ / CX更麻烦,您可能无法使用所有功能,例如简单的XAML接口,不确定。

It is unmanaged C++ which you build into WinRT components. 它是你在WinRT组件中构建的非托管C ++。 These components can then be referenced by your HTML5 or Win8 .NET apps. 然后,您的HTML5或Win8 .NET应用程序可以引用这些组件。

为了增加Slugart的好答案,您可以为WinRT应用程序(和Java Script)编写非托管C ++,他们也可能将Microsoft的这种能力扩展到Windows Phone 8(目前还不可能) - 这将是一些开发团队的主要合作伙伴,包括我自己的团队。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM