[Help] all __gshared vairable address is 0.

XavierAP n3minis-git at yahoo.es
Wed Aug 28 09:05:15 UTC 2019


On Sunday, 25 August 2019 at 12:12:51 UTC, lili wrote:
> Hi:
>     I'm writing a OS kernel in D. I meet a problem that all bss 
> variables's address is same
>     and is 0.
>
>    see code below:
>
> extern(C) extern __gshared ulong  p4_table; //defined in a 
> boot.s file
> __gshared int xx= void;
> abstract final class Vga
> {
>     void init()
>     {
>         clearScreen();
>         Vga.println(cast(ulong)p4_table); //0
>         Vga.println(cast(ulong)&xx); //0
>     }
> but i see the link map file p4_table and xx has different 
> address.

Welp... I don't know. But in any case in principle you should use 
the portable alias size_t for pointers:

https://dlang.org/spec/type.html#size_t


More information about the digitalmars-d-ldc mailing list