C++ Modules on experimental level is supported on vs2017, 15.9.3.
C++ Modules can be linked as a static libraries, but not as .dll’s. C++ modules are .ifc files, which includes binary serialized form of C++ header (*.h) files, but not implementation. Implementation is supplied in static libraries.
On forum there is mentioned ifc.exe command line tool for manipulating .ifc files, but unfortunately it does not work at all.
There is no documentation on how they plan to export classes over .dll boundary. __declspec(dllexport) can be used, but it’s ignored by compiler.
To make your own modules - you must have static library with special compiler flag “/module:export”.
For using or making your own c++ modules you must use as “C++ Language Standard” as “ISO C++ Latest Draft Standard (/std:c++latest)” and “Enable C++ Modules Support (experimental)” to “Yes (/experimental:module)”.
Intellisense gives some errors (not manifested by compiler) with your own c++ modules.
To use standard c++ modules even standard cout gives compiler error, which cannot be disabled except with
#pragma warning(disable:4996)
(This has something to do with special define handling in c++ modules).
To use your own c++ module you need to use
/module:reference “<path to .ifc file>”
from compiler flags and also link static library itself.
Go to definition and intellisense does not work for functions in system c++ modules. Go to definition works only if your solution includes project from where .ifc was compiled from - but go to definition works without header files - so jumping directly to implementation in .cpp file. (No header files in that sense).
Debugging / step in in C++ modules seems to be working ok.
.ifc file format seems to be binary serialization of c++ type information. It’s analogue of clang abstract syntax tree (AST), but on Microsoft they tried to follow ideas of Gabriel Dos Reis and Bjarne Stroustrup -
A Principled, Complete, and Efficient Representation of C++
http://www.stroustrup.com/gdr-bs-macis09.pdf
There also exists early prototype of IPR Internal Program Representation in here:
Compiler-neutral Internal Program Representation for C++
https://github.com/GabrielDosReis/ipr
But it does not gives a sample of binary serialization / deserialization.
I’ve queried about IPR / IFC parsers from multiple places but did not receive any reply yet.
Related articles:
C++ Modules in VS 2015 Update 1
https://blogs.msdn.microsoft.com/vcblog/2015/12/03/c-modules-in-vs-2015-update-1/#comment-896805
Using C++ Modules in Visual Studio 2017
https://blogs.msdn.microsoft.com/vcblog/2017/05/05/cpp-modules-in-visual-studio-2017/