https://issues.dlang.org/show_bug.cgi?id=23837

--- Comment #3 from Walter Bright <[email protected]> ---
The `__init{struct name}` symbol is generated as the initializer for a struct
by the dmd.tocsym.toInitializer() function. It is inserted into the object file
generated for the source file with the struct definition in it. Hence,

    dmd -m32 main.d

will fail to link, because the object file for test.c is not linked in. To fix,

    dmd -m32 main.d test.c

So why does the former still work on other platforms? If the struct is zero
initialized, a section in the BSS segment of all zeros is used instead. But the
relocations for BSS do not work for MSCOFF-32.

Since C structs are always default initialized to zero, a better solution would
be to initialize the instance with code rather than copying zero'd data to it.

--

Reply via email to