link errors when using extern (C) structs

Nicholas Wilson iamthewilsonator at hotmail.com
Sun Oct 28 04:36:35 UTC 2018


On Sunday, 28 October 2018 at 04:23:27 UTC, DanielG wrote:
> On Sunday, 28 October 2018 at 03:39:41 UTC, Nicholas Wilson 
> wrote:
>> write struct Foo {
>>     double bar = 0.0; // The bitpattern of 0.0 is 0
>> }
>
> Thank you for your response.
>
> Can you elaborate on 'write struct...'? Is that special syntax?

Nope thats me not proofreading my posts properly, sorry.

>  I also checked to see if you meant "(manually re-write it 
> as...)", but updating the struct definition in the generated .d 
> header with field values doesn't seem to solve the __initZ 
> issue, either.

Hmm thats, odd unless there are other fields with initialisers 
that are forcing its emission.

> And redefining it in the client .d module just shadows the
> header definition, so ...

Try not using the .di files at all. I've never had any use for 
them personally. Wrapping a C library, all thats required is 
definitions of the functions and types declared by the headers. 
this can be done with a .d file.




More information about the Digitalmars-d-learn mailing list