How do I consume raw COM interfaces from a Windows Runtime metadata file?
Suppose somebody gives you a Windows Runtime metadata file. You can use it from C++ by asking
cppwinrt.exe to generate C++/WinRT headers for them. But what if you are writing a C++ program that doesn’t use exceptions,¹ or for a C program? You want to access the raw COM interfaces rather than the exception-based projection. What can you do?
There is a raw COM counterpart to
cppwinrt.exe which produces raw COM interfaces rather than C++/WinRT projections. It goes by the name Microsoft.
cppwinrt.exe; the difference is that the output is raw COM header files, which you can include from your C or C++ project, and then either consume directly or wrap inside a non-exception-based smart pointer library like WRL.
¹ For example, video games operate under tight real-time constraints and typically restrict themselves to a subset of C++ that, among other things, does not use exceptions.