extern(C) with function returning user type

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 29 18:14:02 PDT 2015


On Wednesday, 29 July 2015 at 18:42:45 UTC, Kyoji Klyden wrote:
> Thanks for the replies,
>
> This issue really highlights one of D's weak points I think.
>
> I've atleast got a round about solution almost working. :P

Really? I see it as one of D's strengths. It's much easier to 
connect D with C than it is to connect other languages with C. 
Essentially, you're just rewriting the C header in D and that's 
it. It's as simple as it can get without the compiler being able 
to directly parse C headers. In that case, the compiler would 
either be needlessly complex or have a dependency on something 
like libclang. This is much more appropriate for a tool, not the 
compiler. Besides, it's quite easy to do it by hand.


More information about the Digitalmars-d-learn mailing list