Creating D bindings for a C library

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


On Wednesday, 25 November 2015 at 21:19:51 UTC, Andy Smith wrote:
> 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.

PS - I forgot to insert the words 'by hand' in there somewhere. 
Also for additional guidance aldacron has some good blog posts on 
the wrapping process on the web somewhere. I pretty much used his 
guidance when I started my experiments with wrapping and have to 
say I was pretty satisfied with the end results :-)


More information about the Digitalmars-d-learn mailing list