D and C APIs

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 12 02:43:40 PST 2016


On Tue, 2016-01-12 at 08:12 +0000, Atila Neves via Digitalmars-d wrote:
> 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++?
> 
> This is the kind of thing I wrote reggae for. CMake is an 
> alternative, but I'd rather write D than CMake script.

CMake scripts are hideous in that the language is like nothing else,
other than perhaps m4 macros. They should have used Lisp. Or Python.

I must try Reggae at some stage, but for now I need to progress this Me
TV rewrite. D and Rust provide so many barriers to effective use of a C
library, that I am resorting to using C++. Yes you have to do extra
stuff to avoid writing C code, but nowhere near the amount you have to
to create D and Rust adaptors.

Also using CMake and C++ I can use CLion, which seems to be far
outstripping Eclipse/CDT and Netbeans as a C++ IDE. I still really
dislike CMake scripts though.
 
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20160112/c715264f/attachment.sig>


More information about the Digitalmars-d mailing list