Building C++ Modules

Play Building C++ Modules
Sign in to queue


C++ Modules TS is now implemented (to various degrees) by GCC, Clang, and MSVC. The aim of this talk is to provide practical information on the mechanics of creating and consuming modules with these compilers. It is based on our experience adding modules support to the build2 toolchain and then modularizing some of its components. We start with a brief introduction to C++ modules, why we need them, and how they relate to other physical design mechanisms, namely headers, namespaces, and libraries. Next we explore the kind of integration modules will require from a C++ build system. Specifically, when and where a module binary interface is built? How can a build system discover which modules are needed? What are the implications for parallel and distributed builds? Can we finally get rid of the preprocessor? And what happens to header-only libraries in this brave new modularized world? With a firm understanding of the implications C++ modules have on the build process, we can try to answer some of the module design questions: What is an appropriate module granularity? Should we have separate module interface and implementation units? Can we have a dual header/module interface for legacy support? Are module-only libraries to become all the rage?


cppcon2017, C++



Session Type:






Download this episode

Download captions

The Discussion

Add Your 2 Cents