C++ _declspec(selectany) CApp* theApp=0;

Nathan Reed nathaniel.reed at gmail.com
Thu Sep 27 15:46:30 PDT 2007


BLS wrote:
> _declspec(selectany) CApp* theApp=0;
> I guess it is just a global var .... in D probabely simply :
> 
> CApp theApp = null;
> 
> I don't know. Some ideas ?
> Bjoern

In C++, declspec(selectany) is a directive to the linker to ignore 
multiple definitions of a symbol, and just pick one arbitrarily at link 
time.

In D, there is no equivalent, but then you shouldn't need one, as you 
can define the variable in some module and import the module in all 
other modules that need it.

Thanks,
Nathan Reed


More information about the Digitalmars-d-learn mailing list