On Wednesday, 16 June 2021 at 23:20:26 UTC, Ali Çehreli wrote:
Thank you, both. It still rules out an address at "compile
time" in general. For example, we cannot use such an address
when instantiating a template, or static array length, etc.
And if I understand it correctly, there must be a p
On Wednesday, 16 June 2021 at 22:16:54 UTC, H. S. Teoh wrote:
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 i
On Wednesday, 16 June 2021 at 21:42:41 UTC, Ali Çehreli wrote:
On 6/16/21 8:47 AM, Doeme wrote:
> On Wednesday, 16 June 2021 at 13:36:07 UTC, Ali Çehreli wrote:
>> On 6/16/21 2:27 AM, Doeme wrote:
>>
>> > How does one get the address of a struct member?
>>
>> Here is an experiment with offsetof
On Wednesday, 16 June 2021 at 11:56:31 UTC, Mike Parker wrote:
https://dlang.org/spec/pragma.html#crtctor
Very interesting, thanks for the hint! This is definitely a
viable solution, though if there's a way to let the linker
determine the pointer address, that'd be even better.
In C, it's a
On Wednesday, 16 June 2021 at 13:36:07 UTC, Ali Çehreli wrote:
On 6/16/21 2:27 AM, Doeme wrote:
> How does one get the address of a struct member?
Here is an experiment with offsetof and opDispatch:
Cool stuff!
I actually tried a very similar approach once, but it did not
work out, since the
Hi!
I'm currently investigating why I can not take the address of a
static struct-element at compile time (afaik the linker should be
able to resolve this, and doing the identical thing in C works...)
```d
struct Foo{
ubyte bar;
}
__gshared Foo foo;
void* baz = \&foo; //works
void* ba