Is it possible to use global variables spanning modules?
    Adam D. Ruppe 
    destructionator at gmail.com
       
    Fri Jun 21 12:28:04 PDT 2013
    
    
  
On Friday, 21 June 2013 at 17:47:49 UTC, Gary Willoughby wrote:
> Do you import the module that declares the __gshared var or 
> import the var itself?
Import the module then use the variable.
module globals;
int a; // or could be __gshared if you don't want it to be thread 
local
module test1;
import globals;
a = 10;
module test2;
import globals;
assert(a == 10); // ok because we set it in test1
    
    
More information about the Digitalmars-d-learn
mailing list