Using glibc headers with ImportC

2022-11-12 Thread qua via Digitalmars-d-learn
I'm trying to get D to use my system's libc. First of all, is such a thing possible with importc? Walter Bright's slides on importc say it should be "as easy as import stdio;", but it doesn't seem to be the case yet. In the specification page I see that importc looks for .c and .i files, not .h

Re: Using glibc headers with ImportC

2022-11-12 Thread qua via Digitalmars-d-learn
This is supposed to work, right? ``` import stdio; void main() { printf("Hello, World!\n"); } ``` In my case, DMD complains of not being able to read `stdio.d`. What am I doing wrong? I'm not using any compiler switch.

Re: Using glibc headers with ImportC

2022-11-12 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 12 November 2022 at 13:46:27 UTC, qua wrote: This is supposed to work, right? No, it isn't. And it probably never will. importC looks for a .c file in the current directory. It is that .c file's responsibility to #include whatever .h files you want.

Re: Using glibc headers with ImportC

2022-11-12 Thread qua via Digitalmars-d-learn
On Saturday, 12 November 2022 at 14:14:06 UTC, Adam D Ruppe wrote: No, it isn't. And it probably never will. importC looks for a .c file in the current directory. It is that .c file's responsibility to #include whatever .h files you want. Okay, thanks, got it. However, I'm still having issue

Re: Using glibc headers with ImportC

2022-11-12 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 12 November 2022 at 14:39:14 UTC, qua wrote: Do I have to do anything else? I've read that importc doesn't have a preprocessor and I assume it is related to that, however "ImportC can automatically run the C preprocessor associated with the Associated C Compiler". I still don't t

Re: Using glibc headers with ImportC

2022-11-12 Thread qua via Digitalmars-d-learn
On Saturday, 12 November 2022 at 14:57:23 UTC, Adam D Ruppe wrote: I still don't think that's been released yet, so if you aren't on the git master or at least the latest beta build it isn't going to work. Which dmd version are you running? I was running 2.098, I have just installed 2.100.2, w

Re: Using glibc headers with ImportC

2022-11-12 Thread bachmeier via Digitalmars-d-learn
On Saturday, 12 November 2022 at 15:08:22 UTC, qua wrote: On Saturday, 12 November 2022 at 14:57:23 UTC, Adam D Ruppe wrote: I still don't think that's been released yet, so if you aren't on the git master or at least the latest beta build it isn't going to work. Which dmd version are you runni

Re: Using glibc headers with ImportC

2022-11-12 Thread qua via Digitalmars-d-learn
On Saturday, 12 November 2022 at 15:13:36 UTC, bachmeier wrote: You're going to need to use the nightly from here: https://github.com/dlang/dmd/releases/tag/nightly While a lot of progress has been made, it's definitely not finished, so you may still encounter errors here and there. Thanks!

Re: Using glibc headers with ImportC

2022-11-13 Thread qua via Digitalmars-d-learn
On Saturday, 12 November 2022 at 14:14:06 UTC, Adam D Ruppe wrote: On Saturday, 12 November 2022 at 13:46:27 UTC, qua wrote: This is supposed to work, right? No, it isn't. And it probably never will. importC looks for a .c file in the current directory. It is that .c file's responsibility to

Re: Using glibc headers with ImportC

2022-11-13 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 13 November 2022 at 09:15:39 UTC, qua wrote: I agree it was unexpected that it didn't, at least for newcomers. Almost everyone is a newcomer when it comes to ImportC.