Creating D bindings for a C library

Andy Smith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 25 13:19:48 PST 2015


On Wednesday, 25 November 2015 at 19:40:28 UTC, Joseph Rushton 
Wakeling wrote:
> On Wednesday, 25 November 2015 at 17:45:48 UTC, ponce wrote:
>> If doing it by hand, some tips here: 
>> http://p0nce.github.io/d-idioms/#Porting-from-C-gotchas
>
> Cool, thanks.  The stuff about using c_long and c_ulong is 
> particularly useful/relevant to my use-case, so it's good to be 
> reminded of that.

Hi Joseph,

How's things in Berlin? :-) I'm not sure how complex the C-Api 
you're wrapping is, but I have to say I found that writing a 
minimal (but complete) subset of an existing C-API to be quite 
straightforward and enjoyable. A plus point was that selecting 
only the useful minimal subset meant the D wrapper ended up being 
a lot cleaner and meant that unused (or undesirable) features 
simply weren't there in the wrapped API.

YMMV but it's one to bear in mind...

Cheers,

A.












More information about the Digitalmars-d-learn mailing list