Managed to find an archive of the KB bug mentioned... known bug for 25 years. The KB is from VC6 which means I think it predates Visual Studio having a public bug database.
You don't, because even if distributed as text, the module interface file is only processed once.
In theory, you can do the same approach, having the preprocessor go one way or the other depending if the library is being compiled, or the application is consuming the library via a module interface file.
However this means you have to organised the build such that the BMI isn't reused across the various build steps, rather newly generated depending on what is being compiled.
So far I have only used static libraries with modules, because of these type of questions.
This is also not only specific to Windows, there are UNIX platforms like Aix, and other mainframe/microcomputer OSes that take the same approach for shared libraries.
9
u/fsfod Oct 06 '26
Random fun dllexport fact this simple bit of code has been broken for decades on MSVC.
https://developercommunity.visualstudio.com/t/c2487-in-dllexport-class-with-static-members/69878
12
u/jedwardsol const & Oct 05 '26
Re: dll import thunks: if you compile with
/GL(whole program optimisation) then the optimiser removes the thunks if you do happen to forgetdllimport1
u/OrphisFlo I like build tools Oct 06 '26
Quick question, how do you make the traditional macro for this work with modules?