C++/WinRT: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Added infobox to show information about C++/WinRT at a glance.
No edit summary
Line 1: Line 1:
{{Infobox software
{{Infobox software
| name =C++/WinRT
| name = C++/WinRT
| author = Kenny Kerr<ref>{{cite web |title=Embracing Standard C++ for the Windows Runtime |url=https://channel9.msdn.com/Events/CPP/CppCon-2016/CppCon-2016-Kenny-Kerr--James-McNellis-Embracing-Standard-C-for-the-Windows-Runtime}}</ref>
| author = [https://kennykerr.ca/ Kenny Kerr]<ref>{{cite web |title=Embracing Standard C++ for the Windows Runtime |url=https://channel9.msdn.com/Events/CPP/CppCon-2016/CppCon-2016-Kenny-Kerr--James-McNellis-Embracing-Standard-C-for-the-Windows-Runtime}}</ref>
| developer = Kenny Kerr, Scott Jones, Ryan Shepherd
| developer = [https://kennykerr.ca/ Kenny Kerr], Scott Jones, Ryan Shepherd
| released = {{start date and age|2015|06|23|paren=yes}}<ref>{{cite web |title=Modern C++ for the Windows Runtime |url=https://github.com/kennykerr/modern}}</ref>
| released = {{start date and age|2015|06|23|paren=yes}}<ref>{{cite web |title=Modern C++ for the Windows Runtime |url=https://github.com/kennykerr/modern}}</ref>
| latest release version = 1.0.180227.3
| latest release version = 1.0.180227.3
Line 12: Line 12:
| genre = [[Software development tools]]
| genre = [[Software development tools]]
| license = [[MIT]]
| license = [[MIT]]
| website = {{URL|https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/}}
}}
}}


'''C++/WinRT''' is an entirely standard modern C++17 language projection for [[Windows Runtime]] (WinRT) [[API]]s, implemented as a header-file-based library, and designed to provide you with first-class access to the modern [[Windows API]]. With C++/WinRT, you can author and consume Windows Runtime APIs using any standards-compliant C++17 compiler. The Windows SDK includes C++/WinRT; it was introduced in version 10.0.17134.0 (Windows 10, version 1803).
'''C++/WinRT''' is the officially supported, modern C++ language projection for [[Microsoft]]'s [[Windows Runtime]] platform, designed to provide you with first-class access to the modern [[Windows API]]. The C++/WinRT language projection is ''not'' an extension to the C++ language; rather, it's implemented as an entirely standard modern ISO C++17 header-file-based library. With C++/WinRT, you can author and consume Windows Runtime APIs using any standards-compliant C++17 compiler.


C++/WinRT ships as part of the [[Microsoft Windows SDK]]. It was introduced in version 10.0.17134.0 (Windows 10, version 1803) of the SDK. There is also [[Microsoft Visual Studio]] support for C++/WinRT, by means of project and item templates, as well as MSBuild properties and targets. Visual Studio support is provided in the form of the [https://aka.ms/cppwinrt/vsix/ C++/WinRT Visual Studio Extension] (VSIX), which you can download and install from the [https://marketplace.visualstudio.com/ Visual Studio Marketplace].
This is Microsoft's recommended replacement for the Windows Runtime C++ Template Library (WRL) and C++/CX.<ref>{{Cite web|url=https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/|title=C++/WinRT - UWP app developer|last=stevewhims|website=docs.microsoft.com|language=en-us|access-date=2018-06-12}}</ref>

C++/WinRT was originally designed, developed, and released in 2015 by the then-independent software developer [https://kennykerr.ca/ Kenny Kerr]. Shortly afterward, the technology and Kenny's expertise were brought in-house to [[Microsoft]].<ref name="Kk2Ms">[https://msdn.microsoft.com/magazine/mt745090.aspx How Kenny Kerr Brought C++/WinRT to Microsoft] MSDN Magazine</ref> C++/WinRT is now Microsoft's recommended replacement for both the [https://msdn.microsoft.com/en-us/library/hh438466.aspx Windows Runtime C++ Template Library] (WRL), and for [[C++/CX]].<ref name="IntroToCppWinRT">[https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt/ Introduction to C++/WinRT] docs.microsoft.com</ref>

== Overview ==

[[Microsoft]]'s [[Windows Runtime]] is based on [[Component Object Model]] (COM) APIs, and it's designed to be accessed through ''language projections''. A language projection hides the COM details, and provides a more natural programming experience for a given language. For C++ developers, C++/WinRT is the officially supported, modern C++ language projection.

As of version 10.0.17134.0 (Windows 10, version 1803), the [[Microsoft Windows SDK]] contains a header-file-based standard C++ library for consuming first-party [[Windows API]]s (that is, [[Windows Runtime]] [[API]]s in Windows namespaces).<ref name="IntroToCppWinRT"/> C++/WinRT also ships with the cppwinrt.exe tool, which you can point at a [[Windows Runtime]] metadata (.winmd) file to generate a header-file-based standard C++ library that ''projects'' the APIs described in the metadata for consumption from C++/WinRT code. [[Windows Runtime]] metadata (.winmd) files provide a canonical way of describing a Windows Runtime API surface. By pointing the cppwinrt.exe tool at metadata, you can generate a library for use with any runtime class implemented in a second- or third-party Windows Runtime component, or implemented in your own application.

With C++/WinRT, you can also implement your own runtime classes using standard C++, without resorting to COM-style programming. For a runtime class, you describe your types in a [https://docs.microsoft.com/uwp/midl-3/intro/ MIDL file] (.idl), and from that file the midl.exe and cppwinrt.exe tools generate your implementation boilerplate source code files for you, ready for you to add your implementation. You can alternatively just implement interfaces by deriving from a base class that's part of the C++/WinRT header library. These techniques employ the [[curiously recurring template pattern]] for convenient and performant function-calling via static dispatch. In general, C++/WinRT makes clever and efficient use of a host of modern ISO C++11 (and later) language features to the benefit of developer productivity and run-time performance. Features that were not available when C++/WinRT's predecessors ([https://msdn.microsoft.com/en-us/library/hh438466.aspx WRL] and [[C++/CX]]) were designed.


==References==
==References==
Line 23: Line 34:
== External Links ==
== External Links ==


* [https://github.com/Microsoft/cppwinrt Official GitHub Repository]
* [https://github.com/Microsoft/cppwinrt Original C++/WinRT GitHub repository (now archived)]
{{software-stub}}
{{software-stub}}
[[Category:Software]]
[[Category:Software]]

Revision as of 20:53, 7 September 2018

C++/WinRT
Original author(s)Kenny Kerr[1]
Developer(s)Kenny Kerr, Scott Jones, Ryan Shepherd
Initial releaseJune 23, 2015 (8 years ago) (2015-06-23)[2]
Stable release
1.0.180227.3 / 30 April 2018; 6 years ago (2018-04-30)[3]
Preview release
1.0.180801.3 / 4 July 2018; 5 years ago (2018-07-04)[4]
Repository
Written inC++
Operating systemWindows
TypeSoftware development tools
LicenseMIT
Websitedocs.microsoft.com/windows/uwp/cpp-and-winrt-apis/

C++/WinRT is the officially supported, modern C++ language projection for Microsoft's Windows Runtime platform, designed to provide you with first-class access to the modern Windows API. The C++/WinRT language projection is not an extension to the C++ language; rather, it's implemented as an entirely standard modern ISO C++17 header-file-based library. With C++/WinRT, you can author and consume Windows Runtime APIs using any standards-compliant C++17 compiler.

C++/WinRT ships as part of the Microsoft Windows SDK. It was introduced in version 10.0.17134.0 (Windows 10, version 1803) of the SDK. There is also Microsoft Visual Studio support for C++/WinRT, by means of project and item templates, as well as MSBuild properties and targets. Visual Studio support is provided in the form of the C++/WinRT Visual Studio Extension (VSIX), which you can download and install from the Visual Studio Marketplace.

C++/WinRT was originally designed, developed, and released in 2015 by the then-independent software developer Kenny Kerr. Shortly afterward, the technology and Kenny's expertise were brought in-house to Microsoft.[5] C++/WinRT is now Microsoft's recommended replacement for both the Windows Runtime C++ Template Library (WRL), and for C++/CX.[6]

Overview

Microsoft's Windows Runtime is based on Component Object Model (COM) APIs, and it's designed to be accessed through language projections. A language projection hides the COM details, and provides a more natural programming experience for a given language. For C++ developers, C++/WinRT is the officially supported, modern C++ language projection.

As of version 10.0.17134.0 (Windows 10, version 1803), the Microsoft Windows SDK contains a header-file-based standard C++ library for consuming first-party Windows APIs (that is, Windows Runtime APIs in Windows namespaces).[6] C++/WinRT also ships with the cppwinrt.exe tool, which you can point at a Windows Runtime metadata (.winmd) file to generate a header-file-based standard C++ library that projects the APIs described in the metadata for consumption from C++/WinRT code. Windows Runtime metadata (.winmd) files provide a canonical way of describing a Windows Runtime API surface. By pointing the cppwinrt.exe tool at metadata, you can generate a library for use with any runtime class implemented in a second- or third-party Windows Runtime component, or implemented in your own application.

With C++/WinRT, you can also implement your own runtime classes using standard C++, without resorting to COM-style programming. For a runtime class, you describe your types in a MIDL file (.idl), and from that file the midl.exe and cppwinrt.exe tools generate your implementation boilerplate source code files for you, ready for you to add your implementation. You can alternatively just implement interfaces by deriving from a base class that's part of the C++/WinRT header library. These techniques employ the curiously recurring template pattern for convenient and performant function-calling via static dispatch. In general, C++/WinRT makes clever and efficient use of a host of modern ISO C++11 (and later) language features to the benefit of developer productivity and run-time performance. Features that were not available when C++/WinRT's predecessors (WRL and C++/CX) were designed.

References

  1. ^ "Embracing Standard C++ for the Windows Runtime".
  2. ^ "Modern C++ for the Windows Runtime".
  3. ^ "Start developing on Windows 10 April 2018 Update today".
  4. ^ "Windows 10 SDK Preview Build 17749 available now!".
  5. ^ How Kenny Kerr Brought C++/WinRT to Microsoft MSDN Magazine
  6. ^ a b Introduction to C++/WinRT docs.microsoft.com

External Links