www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - (How) can reflection recoginzie `extern` variables?

reply Quirin Schroll <qs.il.paperinik gmail.com> writes:
```d
extern int x;
/****/ int y;
```

(How) can I get the information that `x` is `extern` and `y` is 
not? There seems to be no `__traits` for it.
Oct 11
parent reply Salih Dincer <salihdb hotmail.com> writes:
On Friday, 11 October 2024 at 16:33:55 UTC, Quirin Schroll wrote:
 ```d
 extern int x;
 /****/ int y;
 ```

 (How) can I get the information that `x` is `extern` and `y` is 
 not? There seems to be no `__traits` for it.
There is no __traits mechanism to directly determine whether a symbol is extern. However, the extern linkage is determined at compile time based on how the symbol is defined, and the type of linkage it uses is determined by the compiler. SDB 79
Oct 11
parent Salih Dincer <salihdb hotmail.com> writes:
On Friday, 11 October 2024 at 17:58:00 UTC, Salih Dincer wrote:
 
 There is no __traits mechanism to directly determine ...
```d extern int x; int y; pragma(msg, __traits(isSame, y, x)); ``` I tried it now, but as I said, it wouldn't be unreasonable: SDB 79
Oct 11