|
|
|
|
|
by dyaroshev
532 days ago
|
|
I don't think we understand each other. We want to take one function and compile it twice: ```
namespace MEGA_MACRO { void foo(std::span<int> s) {
super_awesome_platform_specific_thing(s);
} } // namespace MEGA_MACRO
``` Whatever you do - the code above has to be written once but compiled twice.
In one file/in many files - doesn't matter. My point is - I don't think you can compile that code twice if you support modules. |
|
Then we have a table of function pointers to &AVX2::foo, &AVX3::foo etc. As long as the module exports one single thing, which either calls into or exports this table, I do not see how it is incompatible with building your project using modules enabled?
(The way we compile the code twice is to re-include our source file, taking care that only the SIMD parts are actually seen by the compiler, and stuff like the module exports would only be compiled once.)