On Wednesday, 15 December 2021 at 22:01:19 UTC, Jan wrote:
Ha, it works indeed!

```cpp
extern export __gshared static int var;
```

That's a declaration worthy of C++ ! Fewer keywords would be too usable :D

Joking aside, I understood the docs such that `__gshared` actually *is* `static` in D, no? Also why the `export` when it's an extern variable?

I agree that __gshared should imply static. That's probably a bug in the compiler.

Using `extern` without `export` would only work with static linking (on Windows). `export` without `extern` would be exporting the variable for others, like `__declspec(dllexport)` in C++. `export` and `extern` combined imports the variable, like `__declspec(dllimport)`.

Reply via email to