Linking D with C structs

Anthony anthoq88 at gmail.com
Wed Jul 1 05:39:21 UTC 2020


On Monday, 29 June 2020 at 10:44:16 UTC, kinke wrote:
> On Monday, 29 June 2020 at 06:29:38 UTC, Anthony wrote:
>> What does "__initZ" refer to?
>> Does this refer to automatic initialization like "this()"?
>
> Almost, it's the static initializer for that struct, which is 
> omitted because you apparently don't compile/link the module 
> containing the struct declaration. Initialize the char array 
> with zeros (= 0) to make the struct fully zero-initialized, 
> preventing the need for that symbol. chars in D are initialized 
> with 0xFF, unlike byte and ubyte.

Thanks for this!

What do you mean by "which is omitted because you apparently 
don't compile/link the module containing the struct declaration"?

Is there a link step that I'm missing that will make things 
easier for me?
Is there a way to have D automatically get the struct from the c 
files directly?



More information about the Digitalmars-d-learn mailing list