[D-runtime] Supporting different C libraries and architectures

David Nadlinger code at klickverbot.at
Sun Feb 26 07:57:02 PST 2012


On 26 Feb 2012, at 15:41, mta`chrono wrote:
> Am 26.02.2012 15:13, schrieb David Nadlinger:
>> Note aside: Deimos bindings never ever need to be compiled. If they 
>> do
>> require linking in symbols besides the C library itself, it's a bug
>> (at least in my opinion).
>
> There are a lot of excessive macros in C librarys and since there's no
> preprocessor in D, they'll mostly be covered by wrapper functions. So
> commonly deimos isn't just a thin binding, it often adds it's own 
> symbols.

This doesn't preclude the possibility of a »header only« interface – 
you can simply make the macro translations template functions, and 
they'll always be emitted during compilation, instead of being linked 
in.

I think I'm not the only one preferring to avoid the need for linking in 
extra libs – If I remember correctly, the original Deimos manifesto by 
Walter had a similar suggestion/requirement as well.

By the way, the manifesto seems to have disappeared with the move to 
D-Programming-Deimos, we should probably add it to a dlang.org page. 
This page could also include short tips for writing bindings, like the 
above.


David


More information about the D-runtime mailing list