--- main.d module main; extern(C) __gshared int foo; import std; void main() { import foo : func; func; writeln(foo); } --- foo.d module foo; extern extern(C) __gshared int foo; void func() { foo++; }The __gshared is irrelevant to it working between modules, but it is relevant if you want C compatibility between threads (NOTE: extern(C) sets mangling, otherwise the module would be encoded in its name).
- Extern/scope issue DLearner via Digitalmars-d-learn
- Re: Extern/scope issue rikki cattermole via Digitalmars-d-learn
- Re: Extern/scope issue DLearner via Digitalmars-d-learn
- Re: Extern/scope iss... rikki cattermole via Digitalmars-d-learn
- Re: Extern/scope... DLearner via Digitalmars-d-learn
- Re: Extern/... rikki cattermole via Digitalmars-d-learn
- Re: Extern/scope... DLearner via Digitalmars-d-learn
- Re: Extern/scope iss... z via Digitalmars-d-learn
- Re: Extern/scope... DLearner via Digitalmars-d-learn