Creating array of structs being used in C interface

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 27 15:25:57 PST 2016


On Sunday, 27 November 2016 at 13:54:54 UTC, Adam D. Ruppe wrote:
> On Sunday, 27 November 2016 at 12:59:32 UTC, Timoses wrote:
>> [...]
>
> It is a linker problem because you didn't link to it... D 
> structs have an initializer, even if they are used for 
> interfacing with C. This is a small blob of data called 
> something like `_D10neo4jTypes17neo4j_map_entry_t6__initZ`, or 
> can be all zeroes, and is generated with the interface module.
>
> [...]

Unions are supposed to be default initialised with the first 
member,
a ulong and thus should be zero initialised.

> You can often bypass the initializer by using `=0` or `=void` 
> in definitions, but not here... and that is arguably a bug, if 
> you `=void` all fields, it should be free to zero initialize 
> the whole thing, but it doesn't.
>
> [...]


More information about the Digitalmars-d-learn mailing list