Re: D and C APIs

2016-01-13 Thread Atila Neves via Digitalmars-d
On Tuesday, 12 January 2016 at 18:59:01 UTC, Walter Bright wrote: Many times I've considered simply incorporating a C compiler into the D compiler, and then: import "stdio.h"; The perennial problem, however, is the C preprocessor and all the bizarre things people do with it in even the

Re: D and C APIs

2016-01-13 Thread Atila Neves via Digitalmars-d
On Tuesday, 12 January 2016 at 14:10:02 UTC, John Colvin wrote: On Tuesday, 12 January 2016 at 13:24:48 UTC, Russel Winder wrote: On Tue, 2016-01-12 at 11:05 +, John Colvin via Digitalmars-d wrote: […] What's so hard about writing a few function prototypes, aliases and enums? It's

Re: D and C APIs

2016-01-12 Thread Atila Neves via Digitalmars-d
On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote: I am guessing that people have an answer to this: D making use of a C API needs a D module adapter. This can either be constructed by hand (well it can, but…), or it can be auto generated from the C header files and then hand

Re: D and C APIs

2016-01-12 Thread John Colvin via Digitalmars-d
On Tuesday, 12 January 2016 at 10:43:40 UTC, Russel Winder wrote: On Tue, 2016-01-12 at 08:12 +, Atila Neves via Digitalmars-d wrote: On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote: > I am guessing that people have an answer to this: > > D making use of a C API needs a D

Re: D and C APIs

2016-01-12 Thread Jacob Carlborg via Digitalmars-d
On 2016-01-12 13:13, Jacob Carlborg wrote: I assume you mean LLVM. Have you tried one from here [1]. I use the Ubuntu releases to test on Debian 7 (64bit) and 6 (32bit). -- /Jacob Carlborg

Re: On Reggae [was D and C APIs]

2016-01-12 Thread Russel Winder via Digitalmars-d
On Tue, 2016-01-12 at 13:12 +, Atila Neves via Digitalmars-d wrote: > […] > You can also write build descriptions in Python with reggae BTW. Splendid. Python 3 I trust. -- Russel. = Dr Russel Winder t: +44 20

Re: D and C APIs

2016-01-12 Thread Russel Winder via Digitalmars-d
On Tue, 2016-01-12 at 12:56 +, bachmeier via Digitalmars-d wrote: > […] > Sorry I can't offer any help, but I'm genuinely curious by what  > you mean in this part of your quote. If the API is changing, how  > does using C++, or for that matter C, help you? Sure, you can  > include the header

Re: D and C APIs

2016-01-12 Thread Russel Winder via Digitalmars-d
On Tue, 2016-01-12 at 13:13 +0100, Jacob Carlborg via Digitalmars-d wrote: > […] > I assume you mean LLVM. Have you tried one from here [1]. Should > work  > with LLVM 3.1 to 3.5 (at least). This is the matrix of Clang > versions  > that I use for testing [2]. > > > [1]

Re: D and C APIs

2016-01-12 Thread Russel Winder via Digitalmars-d
On Tue, 2016-01-12 at 11:05 +, John Colvin via Digitalmars-d wrote: > […] > > What's so hard about writing a few function prototypes, aliases  > and enums? It's annoying that we have to do it, but compared to  > writing the rest of a project it's always going to be a tiny  > amount of work.

Re: D and C APIs

2016-01-12 Thread John Colvin via Digitalmars-d
On Tuesday, 12 January 2016 at 13:24:48 UTC, Russel Winder wrote: On Tue, 2016-01-12 at 11:05 +, John Colvin via Digitalmars-d wrote: […] What's so hard about writing a few function prototypes, aliases and enums? It's annoying that we have to do it, but compared to writing the rest of a

Re: D and C APIs

2016-01-12 Thread Walter Bright via Digitalmars-d
Many times I've considered simply incorporating a C compiler into the D compiler, and then: import "stdio.h"; The perennial problem, however, is the C preprocessor and all the bizarre things people do with it in even the most mundane header files. The problem is NOT, however, implementing

Re: D and C APIs

2016-01-12 Thread bachmeier via Digitalmars-d
On Tuesday, 12 January 2016 at 16:21:40 UTC, Atla Neves wrote: In C/C++, a change to the headers causes a recompilation which will fail if there are API changes. From any other language, it'll compile, link, and fail at runtime (unless the symbols change name). If you're lucky in an obvious

Re: D and C APIs

2016-01-12 Thread Atila Neves via Digitalmars-d
On Tuesday, 12 January 2016 at 10:43:40 UTC, Russel Winder wrote: On Tue, 2016-01-12 at 08:12 +, Atila Neves via Digitalmars-d wrote: On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote: > [...] This is the kind of thing I wrote reggae for. CMake is an alternative, but I'd

Re: D and C APIs

2016-01-12 Thread Russel Winder via Digitalmars-d
On Mon, 2016-01-11 at 21:42 +, stew via Digitalmars-d wrote: > […] > At work we use CMake and have a target for this. The DStep target  > is invoked whenever the C headers change. We also use SWIG this  > way. Both tools often require some hand-massaging though. […] I tried downloading

Re: D and C APIs

2016-01-12 Thread Russel Winder via Digitalmars-d
On Tue, 2016-01-12 at 08:12 +, Atila Neves via Digitalmars-d wrote: > On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote: > > I am guessing that people have an answer to this: > > > > D making use of a C API needs a D module adapter. This can  > > either be constructed by hand

Re: D and C APIs

2016-01-12 Thread Jacob Carlborg via Digitalmars-d
On 2016-01-12 11:39, Russel Winder via Digitalmars-d wrote: I tried downloading pre-built Linux DStep, but it requires an .so link that doesn't exist on Debian Sid or Fedora Rawhide. I hacked something and DStep segfaulted. I assume you mean LLVM. Have you tried one from here [1]. Should work

Re: D and C APIs

2016-01-12 Thread bachmeier via Digitalmars-d
On Tuesday, 12 January 2016 at 10:43:40 UTC, Russel Winder wrote: D and Rust provide so many barriers to effective use of a C library, that I am resorting to using C++. Yes you have to do extra stuff to avoid writing C code, but nowhere near the amount you have to to create D and Rust

Re: D and C APIs

2016-01-12 Thread Atila Neves via Digitalmars-d
On Tuesday, 12 January 2016 at 11:05:38 UTC, John Colvin wrote: On Tuesday, 12 January 2016 at 10:43:40 UTC, Russel Winder wrote: On Tue, 2016-01-12 at 08:12 +, Atila Neves via Digitalmars-d wrote: On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote: > [...] This is the kind

Re: D and C APIs

2016-01-12 Thread Joakim via Digitalmars-d
On Tuesday, 12 January 2016 at 13:17:16 UTC, Russel Winder wrote: On Tue, 2016-01-12 at 13:13 +0100, Jacob Carlborg via Digitalmars-d wrote: [...] […] [...] I tried on Debian Sid. I have both LLVM 3.6 and 3.7 installed (3.6 is still the default but I am using 3.7 to build LDC. I have yet

Re: D and C APIs

2016-01-12 Thread Atla Neves via Digitalmars-d
On Tuesday, 12 January 2016 at 12:56:39 UTC, bachmeier wrote: On Tuesday, 12 January 2016 at 10:43:40 UTC, Russel Winder wrote: D and Rust provide so many barriers to effective use of a C library, that I am resorting to using C++. Yes you have to do extra stuff to avoid writing C code, but

Re: D and C APIs

2016-01-11 Thread stew via Digitalmars-d
On Monday, 11 January 2016 at 17:25:26 UTC, Russel Winder wrote: I am guessing that people have an answer to this: D making use of a C API needs a D module adapter. This can either be constructed by hand (well it can, but…), or it can be auto generated from the C header files and then hand

D and C APIs

2016-01-11 Thread Russel Winder via Digitalmars-d
I am guessing that people have an answer to this: D making use of a C API needs a D module adapter. This can either be constructed by hand (well it can, but…), or it can be auto generated from the C header files and then hand massaged (likely far better). I think the only tool for this on Linux