Skip to content

Commit ed6fb1d

Browse files
committed
docs: record the regex-scanner gotcha in the build-module design
1 parent 13f6cd4 commit ed6fb1d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.agents/docs/2026-06-30-build-mcpp-module-library-design.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ The raw stdout protocol stays the documented low-level substrate; `import mcpp;`
105105
the typed layer over it (the Cargo `build-rs`-over-`cargo::` shape, but
106106
engine-bundled à la Zig).
107107

108+
## Implementation gotcha (recorded)
109+
110+
The embedded source contains the line `export module mcpp;`. mcpp's **default
111+
line-based regex module scanner** (used on the Windows self-host build; the P1689
112+
compiler-driven scanner ignores string literals) read that line *inside the raw
113+
string literal* as `build_program.cppm` declaring a second module → "file already
114+
exports module … cannot export 'mcpp'". Fix: write the declaration with a
115+
`@MODULE@` placeholder substituted to `export module` at file-write time, so no
116+
literal `export module <name>` text appears in mcpp's own source. (A broader fix
117+
would be to teach the regex scanner to skip string/raw-string literals.)
118+
108119
## Coverage / stability boundaries (recorded)
109120

110121
- **Windows/macOS Clang path** is exercised by the mcpp-index `build-mcpp`

0 commit comments

Comments
 (0)