Earlier this week, Kenny Kerr presented C++/WinRT at CppCon 20161. It is a Standard C++ projection for the Windows Runtime, based on Modern.
As far as I understand, the C++/CX compiler/preprocessor/code generator doesn't touch Standard C++ code, and with C++/WinRT being a Standard C++ library it is my naïve interpretation, that both C++/CX and C++/WinRT can be used in the same project.
Questions:
- First things first: Is my naïve interpretation correct?
- If so, can C++/CX and C++/WinRT be used in the same compilation unit?
- At what granularity can C++/CX and C++/WinRT be mixed, in case they cannot reside in the same compilation unit?
- Can C++/WinRT consume types implemented with C++/CX in the same project? (I expect this to be difficult, since the C++/WinRT compiler needs to generate headers from the .winmd metadata, so there is a dependency on the (pre-)compiler output.)
In case it matters, answers to those questions allow me to make decisions now on how to move my C++/CX projects into the future.
1 Embracing Standard C++ for the Windows Runtime (on YouTube).
ref class
es, as well as .winmd metadata, so using aref class
from C++/WinRT code in the same compilation unit should prove difficult. While compiling the code, it needs the .winmd input, which is a product of compiling. Plus, I don't know whether the C++/CX compiler produces any code from imported .winmd data, that (potentially) collides with C++/WinRT#include
s. – Bassinet