Howto create bindings?

bachmeier no at spam.net
Sat Sep 28 10:15:05 UTC 2019


On Saturday, 28 September 2019 at 09:18:24 UTC, Martin Brezeln 
wrote:
> Hello everyone,
>
> i have a rather general question about how to approach the 
> attempt to create a binding for a foreign system, for which 
> bindings already exists for other languages than dlang.
>
> To be more concrete: There is this Database i am using in some 
> recent projects: "Apache Cassandra" / "ScyllaDB" - 
> unfortunately, there is no binding for D (afaik "cassandra-d" 
> is incomplete and the development stands still).
> However, There are some up to date bindings for other 
> programming languages 
> (https://docs.scylladb.com/using-scylla/scylla_drivers/).
>
> Can someone with experience in this field give some advice?
> Would it be possible to use (e.g.) the C++ Project to build 
> $SOMETHING for D?
> Or would it be better to try to implement it yourself (based on 
> a paper or a existing binding)?
>
> Looking forward for an interesting read :)

If this is a C library (I can't really tell for sure from the 
linked page) you can use DStep to automatically create bindings:
https://github.com/jacob-carlborg/dstep

If you don't want bindings, but just want to #include the header 
files, you can use dpp
https://github.com/atilaneves/dpp

For the most part, if you want to use C libraries in a project, 
you shouldn't need to do much work. To do it manually, there's 
this page
https://dlang.org/spec/interfaceToC.html


More information about the Digitalmars-d-learn mailing list