Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

C++/WinRT

From Wikipedia, the free encyclopedia
Software library
This articlemay be too technical for most readers to understand. Pleasehelp improve it tomake it understandable to non-experts, without removing the technical details.(March 2019) (Learn how and when to remove this message)
C++/WinRT
Original authorKenny Kerr[1]
DeveloperMicrosoft
Initial releaseJune 23, 2015 (10 years ago) (2015-06-23)[2]
Stable release
2.0.250303.1 / 29 May 2025; 8 months ago (2025-05-29)[3]
Written inC++
Operating systemMicrosoft Windows
PredecessorC++/CX, WRL
TypeSoftware development tools
LicenseMIT License
Websiteaka.ms/cppwinrt
Repositorygithub.com/Microsoft/cppwinrt

C++/WinRT is aC++ library forMicrosoft'sWindows Runtime platform, designed to provide access to modernWindows APIs. C++/WinRT is provided as a standard C++17 header file library, unlikeC++/CX, which is an extension to C++ and requires a recent version ofMicrosoft Visual C++.[4]

C++/WinRT was introduced as part of theMicrosoft Windows SDK in version 10.0.17134.0 (Windows 10, version 1803) and is a component ofWindows App SDK (formerly known as Project Reunion).Microsoft Visual Studio support for C++/WinRT is provided by an officially-supported extension.[5]

C++/WinRT was originally released in 2015 by Kenny Kerr, who shortly afterward joined Microsoft.[6] C++/WinRT is now Microsoft's recommended replacement for both theWindows Runtime C++ Template Library (WRL), and for C++/CX.[4]

Overview

[edit]

Microsoft'sWindows Runtime is based onComponent Object Model (COM) APIs, and is designed to be accessed throughlanguage 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), theMicrosoft Windows SDK contains a header-file-based standard C++ library for consuming first-partyWindows APIs (that is,Windows RuntimeAPIs in Windows namespaces).[4] C++/WinRT also ships with thecppwinrt.exe tool, which can be pointed at aWindows Runtime metadata (.winmd) file to generate a header-file-based standard C++ library thatprojects 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 thecppwinrt.exe tool at metadata, users can generate a library for use with any runtime class implemented in a second- or third-party Windows Runtime component, or implemented in their own application.

With C++/WinRT, users can also implement their own runtime classes using standard C++, without resorting to COM-style programming. For a runtime class, types can be described in aMIDL file (.idl), and from that file themidl.exe andcppwinrt.exe tools generate the implementation boilerplate source code files, ready for users to add their own implementation. Alternatively, users can just implement interfaces by deriving from a base class that's part of the C++/WinRT header library. These techniques employ thecuriously recurring template pattern for function-calling via static dispatch. C++/WinRT makes use of a host of modern ISO C++11 (and later) language features to increase productivity and run-time performance; these features were not available when C++/WinRT's predecessors (WRL andC++/CX) were designed.

History

[edit]

Design and development of C++/WinRT was begun in 2014 by the then-independent software developerKenny Kerr. At the time, the prevailing way for developers to callWindows Runtime APIs using C++ was with theC++/CX language projection. C++/CX adds non-standard extensions to the C++ language, such as theref new and^ (hat) notation inherited from C++/CLI. It hadn't been fully appreciated then that advances in ISO C++ language features meant that it had become possible to design a Windows Runtime language projection for standard C++, without extensions. "There are a lot of very experienced C++ developers at Microsoft who have spent decades-long careers working with C++ and COM," Kerr says. "I think it took someone who didn't realize that it was impossible to just try it anyway and show that it works."[6]

"I had had some previous experience projecting COM APIs into modern C++, so I decided to see whether I could apply those same techniques to the Windows Runtime." One early challenge in developing C++/WinRT was managing the trade-offs that the Windows Runtime makes to support projections forJavaScript and managed .NET languages out of the box. The complexity in the way that generic collections work across language projections is another example of these design challenges, as was coming up with an efficient way for standard C++ to handle the Windows Runtime's interface-versioning model. "It really pushed my understanding of C++ at that time, and it's since pushed theMicrosoft Visual C++ compiler to more efficiently handle such techniques at this scale."

According to Kenny Kerr, C++/WinRT has been put into maintenance mode and will not be adding any new features, and there is no further plans for a C++/WinRT version 3, further saying that "cppwinrt has reached all of its goals and is generally considered complete and largely bug-free".[7][8] The "Windows Implementation Library" (WIL), also by Microsoft, was described as a complementary library which may receive additional helpers in the meantime.[9]

References

[edit]
  1. ^Kerr, Kenny; McNellis, James (November 2, 2016)."CppCon 2016: Embracing Standard C++ for the Windows Runtime".Channel 9. Microsoft. RetrievedNovember 1, 2019.
  2. ^Kerr, Kenny."Modern C++ for the Windows Runtime".GitHub. RetrievedNovember 1, 2019.
  3. ^"C++/WinRT package".NuGet. Microsoft. RetrievedAugust 31, 2025.
  4. ^abcWhite, Steven (April 17, 2019)."Introduction to C++/WinRT".Windows Dev Center. Microsoft. RetrievedJuly 10, 2019.
  5. ^"C++/WinRT Visual Studio Extension".Visual Studio Marketplace. Microsoft. RetrievedNovember 1, 2019.
  6. ^abDesmond, Michael (January 2017)."Outside In: How Kenny Kerr Brought C++/WinRT to Microsoft".MSDN Magazine. Microsoft. RetrievedNovember 1, 2019.
  7. ^Kenny Kerr (7 April 2023)."C++ 20 and beyond (cppwinrt v3)".github.com. github.com/microsoft.
  8. ^Kenny Kerr (28 August 2023)."Allow passing array_view as span".github.com. github.com/microsoft.
  9. ^Microsoft Corporation (26 January 2026)."microsoft/wil - Windows Implementation Library".github.com. github.com/microsoft.

External links

[edit]
Wikibooks has a book on the topic of:Windows Programming
Overview
Software
Applications
Video games
Programming
languages
Frameworks,
development tools
Operating systems
Other
Licenses
Forges
Related
Features
Standard Library
Ideas
Compilers
IDEs
Superset languages
Dialects
Relative to
other languages
People
Retrieved from "https://en.wikipedia.org/w/index.php?title=C%2B%2B/WinRT&oldid=1338732760"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp