**Subject:** Prototype: C++20 module interface discovery from static archives
Dear SG15 members,
I would like to share a small prototype that may be relevant to the ongoing discussion on C++20 module distribution.
Currently, `-lfoo` has no standardized mechanism for module interface discovery. This prototype demonstrates an alternative approach: the compiler can automatically extract `.cppm` source files from `.a` archives, compile the BMI locally, and proceed without any changes to the existing build pipeline.
Repository:
<
https://github.com/moonandlake123/autolink>
The key points:
- `.cppm` source files are packaged into `.a` archives alongside object files at library build time.
- At consumption time, the compiler wrapper scans the archive, extracts and compiles the module interface to BMI, then injects the BMI path into the compiler command.
- No new file format, no BMI standardization, and no ABI changes are required.
- Archives without `.cppm` files are passed through without modification.
The prototype is verified on Clang 21 (Termux). GCC and MSVC adaptations follow the same logic.
I welcome any feedback and would be grateful if this proves useful to the work in SG15.
Best regards,
moonlight