- 
                Notifications
    
You must be signed in to change notification settings  - Fork 264
 
C++ modules conformance #495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
| 
           Great! Another optimization that can help is to separate the platform header generation and app header generation - as the former changes infrequently. Additionally, if the platform headers can be shared across projects - this will help in the build speeds as well.  | 
    
| 
           I tried it with the new pull. 1>------ Build started: Project: cppwinrt_modules, Configuration: Debug Win32 ------ Here is the cl command line:  | 
    
| 
           @mediabuff You need to use Visual C++ 16.5 Preview 2 or later.  | 
    
| 
           Actually, it 16.5/P2. But may be it's related to this error; ' c:\temp\cppwinrt_modules\cppwinrt_modules\main.cpp(1,13): error C2235: mismatching target architecture for compiled module interface for 'winrt' from 'winrt.ifc'  | 
    
| 
           Could be. It looks like you're trying to build this from the IDE. I would suggest following the instructions exactly as I demonstrated above from a single dev command prompt. Keep in mind that C++ module support is still very new and experimental.  | 
    

Now that Visual C++ 16.5 Preview 2 has decent support for C++ modules, I'm able to once again tweak C++/WinRT to support C++ modules as an alternative to precompiled headers. This is still experimental as there remain some minor issues, but it is getting very close.
The
cppwinrt.execompiler will now generate awinrt/winrt.ixxfile that may be compiled as a module as follows:This will compile all of the projected namespaces into a single
winrtmodule. This step takes quite a while - around 2 minutes on my machine. But once that's built, much like a PCH, you can import the module into any (compatible) TU very quickly as follows:Here's a sample app that you can use to test this:
Note the extra libs that are required when compiling with modules. This is a C++ compiler bug.
There's also an issue with coroutines - waiting for a solution from the C++ team.