__init unresolved external when using C library structs converted with dstep

Robert M. Münch robert.muench at saphirion.com
Fri Apr 17 08:59:41 UTC 2020


On 2020-04-16 18:33:51 +0000, Basile B. said:

> On Tuesday, 14 April 2020 at 17:51:58 UTC, Robert M. Münch wrote:
>> I use a C libary and created D imports with dstep. It translates the C 
>> structs to D structs.
>> 
>> When I now use them, everything compiles fine but I get an unresolved 
>> external error:
>> 
>> WindowsApp1.obj : error LNK2019: unresolved external symbol 
>> "myCstruct.__init" (_D7myCStruct6__initZ) referenced in function _Dmain
>> 
>> Any idea what this is about and how to fix it? I'm wondering why D 
>> tries to find the __init function in the C library and not compile it 
>> from the import.
> 
> One way to prevent the problem is to do void initialization each time 
> you declare a variable of this type.

How would that look like?

myStruct ms = void; // ???

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list