Deimos rules?

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 13 14:46:32 PST 2013


On Wednesday, November 13, 2013 23:01:58 Xavier Bigand wrote:
> I work on XCB integration, so I think that I can add bindings in deimos.
> 
> C headers are translated to d modules by using DStep or manually?
> If manually need I respect some syntactical rules?

It's completely project-dependent. Deimos is for D bindings to C libraries. 
They need to be the extern(C) declarations which correspond to the C header 
declarations without any D wrappers. Beyond that, how the project is put 
together or how the bindings are generated is really up to whoever does the 
header translation. DStep is new enough that I expect that most of Deimos has 
been converted by hand. There's also htod on Windows, but it does a pretty 
poor job, because it's D1-compatible (e.g. it doesn't handle const right).

So, you can translate the headers however you want, and there are no syntactic 
rules. I'd say that you should follow the same file layout as the actual C 
headers (a one-to-one translation of header.h -> header.d), but how everything 
is formatted in those files doesn't really matter. It's up to you.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list