On Wednesday, 13 November 2013 at 22:46:45 UTC, Jonathan M Davis wrote:
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.

Ah, that reminds that the tutorial needs some good advice about this. As far as I know, DStep is the current state of art.

Reply via email to