Re: Load entire file, as a char array.

2018-09-02 Thread bauss via Digitalmars-d-learn
On Monday, 3 September 2018 at 03:19:39 UTC, Neia Neutuladh wrote: On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko wrote: This should be simple? All I want to do is load an entire file, and access individual bytes. The entire thing. I don't want to have know the file size before hand,

Re: Load entire file, as a char array.

2018-09-02 Thread bauss via Digitalmars-d-learn
On Monday, 3 September 2018 at 06:25:23 UTC, bauss wrote: On Monday, 3 September 2018 at 03:19:39 UTC, Neia Neutuladh wrote: On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko wrote: This should be simple? All I want to do is load an entire file, and access individual bytes. The entire th

Re: Load entire file, as a char array.

2018-09-02 Thread Chris Katko via Digitalmars-d-learn
On Monday, 3 September 2018 at 03:19:39 UTC, Neia Neutuladh wrote: On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko wrote: This should be simple? All I want to do is load an entire file, and access individual bytes. The entire thing. I don't want to have know the file size before hand,

Re: Load entire file, as a char array.

2018-09-02 Thread Neia Neutuladh via Digitalmars-d-learn
On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko wrote: This should be simple? All I want to do is load an entire file, and access individual bytes. The entire thing. I don't want to have know the file size before hand, or "guess" and have a "maximum size" buffer. So far, all google s

Load entire file, as a char array.

2018-09-02 Thread Chris Katko via Digitalmars-d-learn
This should be simple? All I want to do is load an entire file, and access individual bytes. The entire thing. I don't want to have know the file size before hand, or "guess" and have a "maximum size" buffer. So far, all google searches for "dlang binary file read" end up not working for me.

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 names,

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 https://github.co

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 o

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 g

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] https://github.com/ja

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 trie

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 Fon

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 could

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 usi

Re: extern __gshared const(char)* symbol fails

2018-09-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 31 August 2018 at 18:49:26 UTC, James Blachly wrote: On Friday, 31 August 2018 at 17:18:58 UTC, Neia Neutuladh wrote: On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote: Hi all, ... When linking to this library from D, I have declared it as: extern __gshared const(char

Re: anyway to debug nogc code with writeln?

2018-09-02 Thread Dennis via Digitalmars-d-learn
On Saturday, 1 September 2018 at 21:53:03 UTC, aliak wrote: Anyway around this? I don't know if your situation allows it, but you can mark f explicitly as always @nogc. If your design assumes that it's @nogc, it's a good idea to add the attribute anyway. You can also use the C printf functi