Thread overview
New Blog Post: Writing a D Wrapper for a C Library
5 days ago
Mike Parker
5 days ago
ag0aep6g
5 days ago
Walter Bright
5 days ago
Victor Porton decided to port an app he developed for a research project from Ada to D. In the process, he created a bindings and a wrapper for a C library, librdf. In this post, he shares the approach he took to translating the C API into the D wrapper.

The blog:
https://dlang.org/blog/2019/02/10/writing-a-d-wrapper-for-a-c-library/


Reddit:
https://www.reddit.com/r/programming/comments/ap47uf/writing_a_d_wrapper_for_a_c_library/
5 days ago
On 10.02.19 15:19, Mike Parker wrote:
> https://dlang.org/blog/2019/02/10/writing-a-d-wrapper-for-a-c-library/

As far as I see, `context` shouldn't be const.

You cast a const `this` to non-const void* and then "back" to non-const UserIOStream. Then doWriteBytes is called on this seemingly mutable object that's actually const.

If I implement doWriteBytes in a way that mutates the object, I'm violating const.
5 days ago
On 2/10/2019 6:19 AM, Mike Parker wrote:
> Victor Porton decided to port an app he developed for a research project from Ada to D. In the process, he created a bindings and a wrapper for a C library, librdf. In this post, he shares the approach he took to translating the C API into the D wrapper.
> 
> The blog:
> https://dlang.org/blog/2019/02/10/writing-a-d-wrapper-for-a-c-library/
> 
> 
> Reddit:
> https://www.reddit.com/r/programming/comments/ap47uf/writing_a_d_wrapper_for_a_c_library/ 


It's on the front page (number 8) of Hacker News.

https://news.ycombinator.com/news