Can not get struct member addresses at compile time
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Jun 16 22:16:54 UTC 2021
On Wed, Jun 16, 2021 at 02:42:41PM -0700, Ali Çehreli via Digitalmars-d-learn wrote:
[...]
> Actually, it is news to me that the compiler can know (determine?) the
> address of a global variable.
[...]
The compiler does not (and cannot) know. But the runtime dynamic linker
can, and does. The two are bridged by the compiler emitting a
relocatable symbol for the address of the global variable, with a table
of relocations (offsets in the code) that the runtime linker patches the
actual addresses into when the program is executed.
T
--
War doesn't prove who's right, just who's left. -- BSD Games' Fortune
More information about the Digitalmars-d-learn
mailing list