Steps to Reproduce
hello.cppm
module;
#if X == 1
#define EXPORT __declspec(dllexport)
#elif X == 2
#define EXPORT __attribute__((visibility("default")))
#elif X == 3
#define EXPORT
#endif
export module hello;
export EXPORT void f() {}
main.cpp
import hello;
int main()
{
f();
}
commands
clang++ -std=c++20 -fmodule-output -shared hello.cppm -o hello.dll -DX=1
clang++ -std=c++20 -fprebuilt-module-path=. main.cpp -L. -lhello
-DX=1 results in ld.lld error, -DX=2 and -DX=3 have no error.
-DX=1 with windows version of Clang also has no error.