D and C APIs
stew via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jan 11 13:42:20 PST 2016
On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote:
> I am guessing that people have an answer to this:
>
> D making use of a C API needs a D module adapter. This can
> either be constructed by hand (well it can, but…), or it can be
> auto generated from the C header files and then hand massaged
> (likely far better). I think the only tool for this on Linux is
> DStep.
>
> This is all very well for a static unchanging API, but what
> about C APIs that are generated from elsewhere? This requires
> constant update of the D modules. Do people just do this by
> hand?
>
> Is the pain of creating a V4L D module set worth the effort
> rather than just suffering the pain of writing in C++?
At work we use CMake and have a target for this. The DStep target
is invoked whenever the C headers change. We also use SWIG this
way. Both tools often require some hand-massaging though.
I am yet try this with dub but it's on my todo list.
cheers,
Stew
More information about the Digitalmars-d
mailing list