/internalPartition

Use the /internalPartition compiler option to treat the input file as an internal partition unit, which is a module partition implementation unit that doesn't contribute to the external interface of the module.

Syntax

/internalPartition filename

Remarks

The following example demonstrates how to use the /internalPartition option:

Source file m-internals.cpp:

// m-internals.cpp
module m:internals;

void internalFunc() {} // cannot have `export` since this is an internal partition

Source file m.ixx:

// m.ixx
export module m;
import :internals; // Cannot export this partition.

export
void wrapper() { internalFunc(); }

To compile this interface:

cl /std:c++latest /internalPartition /c m-internals.cpp

This option can't be used with the /interface compiler option.

/internalPartition is available in Visual Studio 2019 version 16.10, or later.
/internalPartition requires /std:c++20 or later.

See also

Overview of modules in C++
Using C++ Modules in MSVC from the Command Line
C++ Modules conformance improvements with MSVC in Visual Studio 2019 16.5