extern(C) with function returning user type

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 29 11:21:09 PDT 2015


On 07/29/2015 10:59 AM, Kyoji Klyden wrote:

 > How would I use a C function that's returning a struct?

The binding file must have a matching D struct.

 > auto doesn't
 > work here, and from what I can tell D can't import C headers. (If it
 > really can't then, that would be a very welcome feature)

Header files require a C preprocessor but D does not have one and it 
does not want one. :)

Check Deimos for examples and whether there are bindings already 
available for your lib:

   https://github.com/D-Programming-Deimos/

Ali



More information about the Digitalmars-d-learn mailing list