Tried the following, same result (1,0,2,1): testmain: __gshared int xvar; import testmod;
void main() { import std.stdio; writeln("Entering: main"); xvar = 1; writeln("xvar=", xvar); testsub(); writeln("xvar=", xvar); writeln("Leaving: main"); } testmod: void testsub() { __gshared int xvar; import std.stdio; writeln("Entering: testsub"); writeln("xvar=", xvar); xvar = 2; writeln("xvar=", xvar); writeln("Leaving: testsub"); }