title | description | ms.date | author | ms.author | f1_keywords | helpviewer_keywords | ||||
---|---|---|---|---|---|---|---|---|---|---|
/internalPartition |
Use the /internalPartition compiler option to treat the input file as an internal partition unit. |
11/16/2022 |
tylermsft |
twhitney |
|
|
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.
/internalPartition
filename
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.
You normally shouldn't set this option in the Visual Studio development environment unless you use a different extension for your partition files. By default, the build system applies this option to files that have a .ixx
* extension.
-
To apply the
/internalPartition
option to a file explicitly in the IDE, select the file in Solution Explorer. Right-click to open the context menu and select Properties to open the Property Pages dialog. -
Set the Configuration dropdown to All Configurations. Set the Platform dropdown to All Platforms.
-
Open the Configuration Properties > C/C++ > Advanced property page.
-
Use the dropdown control to modify the Compile As property to Compile as C++ Module Internal Partition (/internalPartition). Choose OK or Apply to save your changes.
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