C++/WinRT

Started by
12 comments, last by Steven Ford 5 years, 7 months ago

What are the benefits of switching from unmanaged C++ to C++/WinRT? Is it just a "more modern" C++ API or are their functionality and/or performance changes as well?

 

🧙

Advertisement

I odn't know about the API at all, but RT means "real-time", you can schedule and run hard real-time tasks on the machine, where 'hard real-time' means it's some sort of disaster if you don't meet the deadline.

Don't think you need that in a game :)

 

WinRT is the new Windows Runtime. It's a base for UWP apps.

Lookie here for a better explanation: https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/

 

Based on their explanation it seems to boast better performance.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

4 minutes ago, Endurion said:

WinRT is the new Windows Runtime. It's a base for UWP apps.

Do the same restrictions with regard to the swap chain configuration as for UWP hold?

Given that I do not intend of creating UWP applications, does it make sense to use WinRT?

🧙

I haven't used WinRT myself, so I can't answer those questions sorry.

I guess since WinRT is rather the groundwork around everything else the same restrictions for UWP and the swap chain apply there as well.


From the looks it can also be used to make non UWP apps/games.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

5 hours ago, matt77hias said:

What are the benefits of switching from C++/CX to C++/WinRT? Is it just a "more modern" C++ API or are their functionality and/or performance changes as well?

 

 

4 hours ago, matt77hias said:

Given that I do not intend of creating UWP applications, does it make sense to use WinRT?

It's hard to answer that without knowing what your goals are.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight

I think the main benefit of using C++/WinRT is you don't have to rely on non-standard language feature/extension (CX). That means you can share the code with some other platform, use the existing code with UWP app, and any C++ developer can write UWP apps without having to learn CX which is not available in other platform.

That said, I haven't tried C++/WinRT yet (although I have a UWP app). 

http://9tawan.net/en/

9 hours ago, ChaosEngine said:

It's hard to answer that without knowing what your goals are.

Basically, I like to switch without any performance decreases or functionality limitations.

The statement:

Quote

The With C++/WinRT, you can author and consume Windows Runtime APIs using any standards-compliant C++17 compiler.

also indicates greater flexibility with regard to other C++ compilers. 

MSDN provides some simple guidelines to perform the switch, but these seem to be true small to suffice.

14 hours ago, matt77hias said:

C++/CX

Currently, I do not use C++/CX, but just unmanaged C++.

But Wikipedia mentions:

Quote

C++/WinRT is now Microsoft's recommended replacement for both the Windows Runtime C++ Template Library (WRL), and for C++/CX.

So this holds for both unmanaged C++ and the weird looking C++/CX (e.g., added ^ syntax elements).

🧙

C++/WinRT is more a replacement for the older Windows APIs in Windows.h, hence "any standards-compliant C++17 compiler" rather than one with special managed extensions. Language integration is done by sticking with plain C calls (like PInvoke) or COM "do the vtable and other c++ features this way" (which I don't think the C++ language specifies but OK...). They do seem to be trying to hide the COM though in the header classes.

https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt

Quote

C++/WinRT is an entirely standard modern C++17 language projection for Windows Runtime (WinRT) APIs, implemented as a header-file-based library, and designed to provide you with first-class access to the modern Windows API.

...

Language projections

The Windows Runtime is based on Component Object Model (COM) APIs, and it's designed to be accessed through language projections. A projection hides the COM details, and provides a more natural programming experience for a given language.

 

 

 

15 hours ago, Endurion said:

Based on their explanation it seems to boast better performance.

I don't see any performance claim on that linked Microsoft page (https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/) in regards to normal C++, only that C++ is faster than "any other language option for the Windows Runtime" (C#, etc.)?

The only performance gain maybe is if the newer API's made some improvements (less calls, avoid extra buffer copies, std::string/etc. integration) or complete replacements (not sure if there are any. Not seen any plan to replace Direct3D, XAudio2, or even force people off Vulkan etc. in favour of some new WinRT low level API).

 

EDIT: Pretty sure it actually is just another COM API.

24 minutes ago, SyncViews said:

EDIT: Pretty sure it actually is just another COM API.

At first glance, the WRL to WinRT mapping seems just like a bijection. But I have nothing against another COM facade.

🧙

This topic is closed to new replies.

Advertisement