Re: #include C headers in D code

2018-04-16 Thread Atila Neves via Digitalmars-d-announce
On Monday, 16 April 2018 at 12:26:12 UTC, Jacob Carlborg wrote: On Monday, 16 April 2018 at 11:20:51 UTC, Atila Neves wrote: You can use the C macros in the headers that you #include in your dpp file. dstep has a lot of code for translating macros. I don't want to translate macros at all,

Re: #include C headers in D code

2018-04-16 Thread Jacob Carlborg via Digitalmars-d-announce
On Monday, 16 April 2018 at 11:20:51 UTC, Atila Neves wrote: You can use the C macros in the headers that you #include in your dpp file. dstep has a lot of code for translating macros. I don't want to translate macros at all, but it's deeply intertwined with translating everything else.

Re: #include C headers in D code

2018-04-16 Thread Atila Neves via Digitalmars-d-announce
On Saturday, 14 April 2018 at 04:07:12 UTC, Petar Kirov [ZombineDev] wrote: On Friday, 13 April 2018 at 10:31:43 UTC, Atila Neves wrote: On Wednesday, 11 April 2018 at 14:33:26 UTC, Jacob Carlborg wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my

Re: #include C headers in D code

2018-04-16 Thread Chris via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary is that, modulo bugs, things like this work

Re: #include C headers in D code

2018-04-13 Thread Petar via Digitalmars-d-announce
On Friday, 13 April 2018 at 10:31:43 UTC, Atila Neves wrote: On Wednesday, 11 April 2018 at 14:33:26 UTC, Jacob Carlborg wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* I don't know the

Re: #include C headers in D code

2018-04-13 Thread Jacob Carlborg via Digitalmars-d-announce
On 2018-04-13 12:33, Atila Neves wrote: I'll have to take a look at Jacob's configure.d to find out where libclang is installed on Windows. Unfortunately the configuration script is only for Posix. -- /Jacob Carlborg

Re: #include C headers in D code

2018-04-13 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 14:57:51 UTC, rumbu wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: [...] Cannot manage to build it on Windows: D:\git\dpp>dub build WARNING: A deprecated branch based version specification is used for the dependency libclang. Please use

Re: #include C headers in D code

2018-04-13 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 14:26:04 UTC, Jacob Carlborg wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* BTW, you can steal the config script [1] from DStep to help detect locations of

Re: #include C headers in D code

2018-04-13 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 14:33:26 UTC, Jacob Carlborg wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* I don't know the exact details of your project but can't you just: 1. Copy the

Re: #include C headers in D code

2018-04-12 Thread Nemanja Boric via Digitalmars-d-announce
On Thursday, 12 April 2018 at 11:43:51 UTC, John Colvin wrote: On Wednesday, 11 April 2018 at 18:36:56 UTC, Walter Bright wrote: On 4/11/2018 3:25 AM, Atila Neves wrote: [...] That's right. There is no general solution. One can only look for common patterns and do those. For example,

Re: #include C headers in D code

2018-04-12 Thread John Colvin via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 18:36:56 UTC, Walter Bright wrote: On 4/11/2018 3:25 AM, Atila Neves wrote: I did the best I could having seen some macros. It's likely there are cases I've missed, or that maybe the translation in the link above doesn't work even for what it's supposed to be

Re: #include C headers in D code

2018-04-11 Thread Kagamin via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 09:45:07 UTC, Jonathan M Davis wrote: It's one thing for someone who is familiar with D to weigh the options and decide that being tied to ldc is okay. It's quite another to tell someone who isn't familiar with D that in order to use D, they have to use a feature

Re: #include C headers in D code

2018-04-11 Thread Kagamin via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 12:22:56 UTC, bachmeier wrote: It also wouldn't work with GDC. Given that GDC has been added to GCC, it would be a bad idea to tell people they need to use LDC to work with C code. Currently porting a project to linux, stuff is so severely outdated, pretty much

Re: #include C headers in D code

2018-04-11 Thread Walter Bright via Digitalmars-d-announce
On 4/11/2018 3:25 AM, Atila Neves wrote: I did the best I could having seen some macros. It's likely there are cases I've missed, or that maybe the translation in the link above doesn't work even for what it's supposed to be doing (I have no confidence about catching all the C casts for

Re: #include C headers in D code

2018-04-11 Thread rumbu via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ Cannot manage to build it on Windows: D:\git\dpp>dub build WARN

Re: #include C headers in D code

2018-04-11 Thread Jacob Carlborg via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* I don't know the exact details of your project but can't you just: 1. Copy the includes 2. Paste them into a C file 3. Run DStep on the C file 4.

Re: #include C headers in D code

2018-04-11 Thread Jacob Carlborg via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* BTW, you can steal the config script [1] from DStep to help detect locations of LLVM/libclang. It also supports static linking. Supports manually

Re: #include C headers in D code

2018-04-11 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 09:45:07 UTC, Jonathan M Davis wrote: It's one thing for someone who is familiar with D to weigh the options and decide that being tied to ldc is okay. It's quite another to tell someone who isn't familiar with D that in order to use D, they have to use a

Re: #include C headers in D code

2018-04-11 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 06:24:38 UTC, Jacob Carlborg wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code

Re: #include C headers in D code

2018-04-11 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 06:21:47 UTC, Jacob Carlborg wrote: On Tuesday, 10 April 2018 at 23:44:46 UTC, Atila Neves wrote: The beauty of using libclang is that name mangling issues don't exist. :) How is that not going to be an issue? Are you adding `pragma(mangle)` everywhere? Yes.

Re: #include C headers in D code

2018-04-11 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 11 April 2018 at 06:12:49 UTC, rikki cattermole wrote: On 09/04/2018 11:03 PM, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary

Re: #include C headers in D code

2018-04-11 Thread Jonathan M Davis via Digitalmars-d-announce
On Wednesday, April 11, 2018 09:23:29 Kagamin via Digitalmars-d-announce wrote: > On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote: > > If you add to all that "No, really, it's ok, there's this > > project that forked one of the compilers. No, it's not the > > reference compiler.

Re: #include C headers in D code

2018-04-11 Thread Kagamin via Digitalmars-d-announce
On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote: If you add to all that "No, really, it's ok, there's this project that forked one of the compilers. No, it's not the reference compiler. There's just this bit of non-standard syntax to learn that's neither C nor D", then the chances

Re: #include C headers in D code

2018-04-11 Thread Jacob Carlborg via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ How do you deal with macros containing invalid D code, i.e

Re: #include C headers in D code

2018-04-11 Thread Jacob Carlborg via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 23:44:46 UTC, Atila Neves wrote: The beauty of using libclang is that name mangling issues don't exist. :) How is that not going to be an issue? Are you adding `pragma(mangle)` everywhere? -- /Jacob Carlborg

Re: #include C headers in D code

2018-04-11 Thread rikki cattermole via Digitalmars-d-announce
On 09/04/2018 11:03 PM, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary is that, modulo bugs, things like this work:     #include     void

Re: #include C headers in D code

2018-04-10 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 20:32:05 UTC, Seb wrote: On Tuesday, 10 April 2018 at 16:51:57 UTC, Atila Neves wrote: If you get to the point where you can #include , it will be doubly impressive! Not *if*, *when*. ;) Atila FYI people have been fighting with this for a long time:

Re: #include C headers in D code

2018-04-10 Thread David Nadlinger via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 20:32:05 UTC, Seb wrote: On Tuesday, 10 April 2018 at 16:51:57 UTC, Atila Neves wrote: If you get to the point where you can #include , it will be doubly impressive! Not *if*, *when*. ;) Atila FYI people have been fighting with this for a long time:

Re: #include C headers in D code

2018-04-10 Thread Seb via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 16:51:57 UTC, Atila Neves wrote: If you get to the point where you can #include , it will be doubly impressive! Not *if*, *when*. ;) Atila FYI people have been fighting with this for a long time: https://github.com/dlang/druntime/pull/1316

Re: #include C headers in D code

2018-04-10 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 19:28:09 UTC, Steven Schveighoffer wrote: On 4/10/18 2:36 PM, Atila Neves wrote: Haha, I remember. I do plan on dealing with emplace_back, but I have no idea how just yet and I was hoping nobody was going to call me on it until then. Busted! :P I think we

Re: #include C headers in D code

2018-04-10 Thread Steven Schveighoffer via Digitalmars-d-announce
On 4/10/18 2:36 PM, Atila Neves wrote: Haha, I remember. I do plan on dealing with emplace_back, but I have no idea how just yet and I was hoping nobody was going to call me on it until then. Busted! :P I think we all agree you aren't going to instantiate C++ templates in D (and who

Re: #include C headers in D code

2018-04-10 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 18:01:37 UTC, Steven Schveighoffer wrote: On 4/10/18 12:51 PM, Atila Neves wrote: On Tuesday, 10 April 2018 at 13:53:34 UTC, Steven Schveighoffer wrote: If you get to the point where you can #include , it will be doubly impressive! Not *if*, *when*. ;) I hope

Re: #include C headers in D code

2018-04-10 Thread Steven Schveighoffer via Digitalmars-d-announce
On 4/10/18 12:51 PM, Atila Neves wrote: On Tuesday, 10 April 2018 at 13:53:34 UTC, Steven Schveighoffer wrote: If you get to the point where you can #include , it will be doubly impressive! Not *if*, *when*. ;) I hope you are right, but I remain skeptical :) If I may throw a curveball

Re: #include C headers in D code

2018-04-10 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 13:53:34 UTC, Steven Schveighoffer wrote: On 4/9/18 7:03 AM, Atila Neves wrote: [...] Awesome. Can't say I will use it, as I don't use C much, but I understand how difficult a task this is. Thanks! If you get to the point where you can #include , it will be

Re: #include C headers in D code

2018-04-10 Thread Steven Schveighoffer via Digitalmars-d-announce
On 4/9/18 7:03 AM, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary is that, modulo bugs, things like this work:     #include     void main

Re: #include C headers in D code

2018-04-10 Thread Joakim via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 09:36:39 UTC, Atila Neves wrote: On Monday, 9 April 2018 at 20:19:35 UTC, Seb wrote: On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote: On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote: [...] This whole idea came about because a couple of years ago

Re: #include C headers in D code

2018-04-10 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 10 April 2018 at 08:45:06 UTC, Walter Bright wrote: On 4/9/2018 4:03 AM, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* Very nice work, and great article! Thanks!

Re: #include C headers in D code

2018-04-10 Thread Atila Neves via Digitalmars-d-announce
On Monday, 9 April 2018 at 20:19:35 UTC, Seb wrote: On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote: On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote: [...] This whole idea came about because a couple of years ago I was in a team that was responsible for legacy code written

Re: #include C headers in D code

2018-04-10 Thread Walter Bright via Digitalmars-d-announce
On 4/9/2018 4:03 AM, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* Very nice work, and great article!

Re: #include C headers in D code

2018-04-10 Thread Stefan via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* neat!

Re: #include C headers in D code

2018-04-09 Thread Seb via Digitalmars-d-announce
On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote: On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote: [...] This whole idea came about because a couple of years ago I was in a team that was responsible for legacy code written in C which had no tests. To write tests, we needed

Re: #include C headers in D code

2018-04-09 Thread Atila Neves via Digitalmars-d-announce
On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ Certainly

Re: #include C headers in D code

2018-04-09 Thread bachmeier via Digitalmars-d-announce
On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ Certainly

Re: #include C headers in D code

2018-04-09 Thread kinke via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ Certainly interesting. Is there a good reason why you didn't look

Re: #include C headers in D code

2018-04-09 Thread Colin via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary is that, modulo bugs, things like this work

Re: #include C headers in D code

2018-04-09 Thread SrMordred via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary is that, modulo bugs, things like this work

Re: #include C headers in D code

2018-04-09 Thread Cym13 via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:48:51 UTC, jmh530 wrote: On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* [snip] Fantastic. This is so cool, I think it should be featured on the D blog as well

Re: #include C headers in D code

2018-04-09 Thread jmh530 via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* [snip] Fantastic.

#include C headers in D code

2018-04-09 Thread Atila Neves via Digitalmars-d-announce
Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ The summary is that, modulo bugs, things like this work: #include void main() { printf("Hello world\n".ptr);