r/cpp • • Mar 09 '26

The compilation procedure for C++20 modules

https://holyblackcat.github.io/blog/2026/03/09/compiling-modules.html
103 Upvotes

47 comments sorted by

View all comments

Show parent comment

2

u/sudgy Mar 09 '26

You can still forward declare in modules by wrapping both the original declaration/definition and the forward declaration in extern "C++"

5

u/ABlockInTheChain Mar 09 '26

You can do that if you control the original declaration.

It does not however work for third party code that was declared with module linkage and that can be a problem in other situations.