Microsoft's
Windows Runtime is based on
Component Object Model (COM) APIs, and is 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). C++/WinRT also ships with the cppwinrt.exe tool, which can be pointed 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, 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 a MIDL file (.idl), and from that file the midl.exe and cppwinrt.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 the
curiously 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 and
C++/CX) were designed. == History ==