r/cpp • u/not_a_novel_account cmake dev • Jun 01 '26
BMI Compatibility: Testing Build System C++ Modules Support
https://blog.vito.nyc/posts/bmi-compatibility/
68
Upvotes
r/cpp • u/not_a_novel_account cmake dev • Jun 01 '26
View all comments
Show parent comment
2
u/not_a_novel_account cmake dev Jun 02 '26
Yes, it's an astute observation, inline function definitions get serialized into BMIs so you can stumble into IFNDR ODR violations very indirectly this way, but this is as risky as header files, not moreso.
It is always a liability. It is necessary, otherwise the module is unusable in different language contexts. The question of "what to swap" is undecided, no one knows. There was work in this area from SG15, prior to the EcosystemIS being withdrawn, but nothing definitive. This is a big problem IMHO.
You're not misunderstanding, there is a new class of header involved here.
It is private in that it is restricted to the provider's context. Only translation units owned by the provider may
#includethis header. In this case it aligns with your understanding, private headers may only be used in "implementation".The problem is with modules, implementation and interface are mixed together. We need to install module TUs, and thus we need ship any private headers they depend on. These headers need not be exposed to projects which consume the installed modules. You can't
#include <private_header.hpp>in your project, the build system will not pass you the-Iflags, but it will use the appropriate-Iflags when creating the BMI.