Re: Example of using C API from D?

2018-09-06 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-09-03 at 11:41 +1200, rikki cattermole via Digitalmars-d-learn wrote: […] > > You won't need to actually fill out any c struct's that you don't need > either. Make them opaque as long as they are referenced via pointer and > not by value. True. And indeed Fontconfig can mostly

Re: DStep rocks [was Example of using C API from D?]

2018-09-03 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-09-03 at 12:45 +, Andrea Fontana via Digitalmars-d- learn wrote: > […] > > I use dpp to generate d code to import: > - Create a temp.dpp file with #include inside > - Run "d++ --preprocess-only temp.dpp" > > Now you have your .d file exactly like in dstep. > So where does this

Re: DStep rocks [was Example of using C API from D?]

2018-09-03 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 3 September 2018 at 10:50:17 UTC, Russel Winder wrote: Interesting alternative to DStep. I came to D to avoid #include, but… I'll give it a whirl once I can get it compiled on Debian Sid. It seems the libclang-dev package does not install a libclang.so symbolic link, you have to be

Re: DStep rocks [was Example of using C API from D?]

2018-09-03 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2018-09-02 at 21:54 +, Laeeth Isharc via Digitalmars-d- learn wrote: > On Sunday, 2 September 2018 at 17:49:45 UTC, Russel Winder wrote: > > […] > > Now to work out how to make the project auto generate this D > > module so as to avoid having it in the repository, and > >

Re: Example of using C API from D?

2018-09-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/09/2018 5:07 AM, Russel Winder wrote: On Mon, 2018-09-03 at 01:00 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] You don't need to create a complete binding for something to use a subset of it. True, but all too often you find there are so many interdependencies of

Re: DStep rocks [was Example of using C API from D?]

2018-09-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 2 September 2018 at 17:49:45 UTC, Russel Winder wrote: On Sun, 2018-09-02 at 18:28 +0100, Russel Winder wrote: […] It turns out that the GIR file is not usable, and so the girtod route is not feasible. I shall try the DStep route. Failing that it seems there is

Re: DStep rocks [was Example of using C API from D?]

2018-09-02 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2018-09-02 at 18:28 +0100, Russel Winder wrote: > […] > It turns out that the GIR file is not usable, and so the girtod route > is not feasible. I shall try the DStep route. Failing that it seems > there is > > https://github.com/WebFreak001/fontconfig-d > > which is a manual transform

Re: Example of using C API from D?

2018-09-02 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2018-09-02 at 18:11 +0100, Russel Winder wrote: > […] > I am not sure if DStep is the right tool for creating a complete D > binding to Fontconfig. Given that Fontconfig has a GIR file, using > girtod may well be the better route. It turns out that the GIR file is not usable, and so the

Re: Example of using C API from D?

2018-09-02 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2018-09-02 at 15:40 +, Arun Chandrasekaran via Digitalmars- d-learn wrote: > […] > > You can look at zmqd[1] as an example. I've been using it in > production. I've also used dstep[2] to translate C headers to D. > > [1] https://github.com/kyllingstad/zmqd > [2]

Re: Example of using C API from D?

2018-09-02 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-09-03 at 01:00 +1200, rikki cattermole via Digitalmars-d- learn wrote: > […] > You don't need to create a complete binding for something to use a > subset of it. True, but all too often you find there are so many interdependencies of names, you end up binding most of the API. I

Re: Example of using C API from D?

2018-09-02 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 2 September 2018 at 12:52:11 UTC, Russel Winder wrote: I am rewriting a C++ program in D, but need to access a C library that has no D binding: this is a GtkD based program which has a Pango binding, but Pango doesn't offer the information I need, that is hidden in the underlying

Re: Example of using C API from D?

2018-09-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/09/2018 12:52 AM, Russel Winder wrote: I am rewriting a C++ program in D, but need to access a C library that has no D binding: this is a GtkD based program which has a Pango binding, but Pango doesn't offer the information I need, that is hidden in the underlying Fontconfig C API. I

Example of using C API from D?

2018-09-02 Thread Russel Winder via Digitalmars-d-learn
I am rewriting a C++ program in D, but need to access a C library that has no D binding: this is a GtkD based program which has a Pango binding, but Pango doesn't offer the information I need, that is hidden in the underlying Fontconfig C API. I could create a complete D binding for Fontconfig