digitalmars.D.announce - New Blog Post: Writing a D Wrapper for a C Library
- Mike Parker (8/8) Feb 10 2019 Victor Porton decided to port an app he developed for a research
- ag0aep6g (7/8) Feb 10 2019 As far as I see, `context` shouldn't be const.
- Walter Bright (3/14) Feb 10 2019 It's on the front page (number 8) of Hacker News.
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/
Feb 10 2019
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.
Feb 10 2019
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_wrap er_for_a_c_library/It's on the front page (number 8) of Hacker News. https://news.ycombinator.com/news
Feb 10 2019