Issue 87887
Summary [C++20] [Modules] unresolved external symbol for `export __declspec(dllexport)` variables from DLL
Labels new issue
Assignees
Reporter huangqinjin
    ### Steps to Reproduce

#### `hello.cppm`
```c++
export module hello;

export __declspec(dllexport) int x = 0;
```

#### `main.cpp`
```c++
import hello;

int main()
{
    return x;
}

```

#### commands
```shell
clang++ -std=c++20 -fmodule-output -shared hello.cppm -o hello.dll
clang++ -std=c++20 -fprebuilt-module-path=. main.cpp -L. -lhello

error LNK2019: unresolved external symbol "int x" (?x@@3HA) referenced in function main
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to