__init unresolved external when using C library structs converted with dstep

Robert M. Münch robert.muench at saphirion.com
Thu Apr 16 09:20:02 UTC 2020

On 2020-04-15 15:18:43 +0000, Steven Schveighoffer said:

> The difference is you are telling the compiler that it should generate 
> any symbols for those types. If you just import them, then it's 
> expecting something else to build those symbols.

Maybe I'm a bit confused, but that's quite different to a C compiler, 
right? If I include header and have a .lib things fit.

With D I have a .lib, I have the imports and still need the imports 
somehow compiled (included in project, or as a 2nd .lib) to make 
everything work. Do I understand that correct?

> You could also build a library that builds those symbols, and link in 
> that library instead.

That would be the 2nd .lib approach than. 

>> What's strange is, that for a dub project that uses the same imports, I 
>> didn't had to add them to the dub.json file. There, it just works 
>> without any problems.
> dub builds all dependencies so this is like the library solution.

But I didn't include the library as a dub dependency. I just have the 
C/C++ compiled lib file and the D imports path for this lib.

Robert M. Münch
smarter | better | faster
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20200416/45a6284b/attachment.htm>

More information about the Digitalmars-d-learn mailing list