Mixing libraries

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 1 21:33:05 PST 2017


On Thursday, 2 March 2017 at 02:27:03 UTC, Jordan Wilson wrote:

>
> Ah yes, I think you explain the difference between 
> wrapper/binding in one of the Derelict docs.
>
> I'm currently working through a ebook on Game Dev with 
> SFML...the examples are all C++.
> I don't have any trouble translating it to the equivalent C 
> bindings (so far anyway), but perhaps in the long run using 
> dsfml will be easier (for example, I found using Iup4d easier 
> than the straight C Iup bindings).

Yes, that's what wrappers are for :-) Plenty of people have built 
wrappers on top of the Derelict bindings. I have my own little 
SDL and GLFW wrappers I use for throw away projects. Makes the 
code cleaner and easier on the eyes (C APIs can be ugly).

Jeremy did a great job with DSFML. When I first implemented 
DerelictSFML, there was a DMD bug on Linux 64-bit that caused 
crashes when passing structs to functions by value, which bits of 
the CSFML API require. That made the binding effectively unusable 
on Linux. Jeremy implemented his own C binding (DSFML-C) which 
eliminated the pass-by-value bits and then built DSFML on top of 
that. IIRC the bug has been fixed since then, so I don't know if 
DSFML is using CSFML directly now or not.


More information about the Digitalmars-d-learn mailing list