[Help!] Use two different assembly symbol in D, but they are same address.

lili akozhao at tencent.com
Sat Aug 24 11:53:01 UTC 2019

   definition _vga_x and _vga_y symbol in asm, compile use nasm -f 
elf64 -o boot.o boot.asm
   [section .bss]

   [global _vga_x]
           resb 8
   [global _vga_y]
           resb 8

   and nm boot.o show below
    00107000 B _vga_x
    00107008 B _vga_y

  and In another D file use this two symbol

extern(C) {
  extern __gshared int _vga_x; //definition in boot.asm
  extern __gshared int _vga_y; //definition in boot.asm

  void tt()
     if (_vga_x == _vga_y)
       //where is true, why?

  but when a run tt so strange things happend that the test is 
  Is where has a coding mistake.
  src  https://github.com/lilijreey/OS-D

More information about the Digitalmars-d-learn mailing list