r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • Apr 19 '26
Using Internal Partitions
https://abuehl.github.io/2026/04/18/using-internal-partitions.htmlWhat is the reason for implicitly importing the interface of the module when implementing the functions of an internal partition?
4
Upvotes
View all comments
Show parent comment
1
u/tartaruga232 MSVC user, r/cpp_modules Apr 21 '26
Is an internal partition. See https://abuehl.github.io/2026/04/09/internal-partitions.html
It produces a BMI and can be imported, but it cannot export anything to the outside of the Core module. Declarations in there cannot be exported.
This is not MSVC specific. That behavior is standard conformant. In order to get the standard-conformant behavior from the MSVC compiler, you need to set that /internalPartition flag. That's indeed confusing but it is just a matter of fact. If that flag is set, MSVC indeed behaves as required by the standard. I was told that CMake (which we don't use) handles setting that flag transparently.
The non-standard behavior of MSVC is not the subject of my blog posting. I played a bit with it but decided not to use it. It is not really documented (other than in a few examples) and Microsoft people don't talk about it nor explain what their motivation for doing that is. Code which would use that non-standard behavior of the MSVC compiler would be non-portable. Code using it would be vendor-locked in.