www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ImportC and .h files

reply Walter Bright <newshound2 digitalmars.com> writes:
Many have mentioned on the n.g. that ImportC wasn't working with this or that
.h 
file. So I've been looking at bugzilla for issues pertaining to that.

Pretty much they are contributions from Jacob Carlborg. I'm halfway through 
fixing those.

But what about yours? I can't fix non-specific things like "doesn't work with h 
files". Help me help you by filing bugzilla issues! Please tag them with the 
"ImportC" keyword.
Jan 10 2023
next sibling parent reply bachmeier <no spam.net> writes:
On Wednesday, 11 January 2023 at 02:59:49 UTC, Walter Bright 
wrote:
 Many have mentioned on the n.g. that ImportC wasn't working 
 with this or that .h file. So I've been looking at bugzilla for 
 issues pertaining to that.

 Pretty much they are contributions from Jacob Carlborg. I'm 
 halfway through fixing those.

 But what about yours? I can't fix non-specific things like 
 "doesn't work with h files". Help me help you by filing 
 bugzilla issues! Please tag them with the "ImportC" keyword.
This one filed by Adam blocks most large C programs from compiling: https://issues.dlang.org/show_bug.cgi?id=23402 A single function definition or enum imported in two places within the same program prevents compilation.
Jan 11 2023
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 1/11/2023 4:18 AM, bachmeier wrote:
 A single function definition or enum imported in two places within the same 
 program prevents compilation.
Thanks. I need reproducible test case, there's too much guesswork needed on my part in the bug report.
Jan 11 2023
parent bachmeier <no spam.net> writes:
On Thursday, 12 January 2023 at 06:30:15 UTC, Walter Bright wrote:
 On 1/11/2023 4:18 AM, bachmeier wrote:
 A single function definition or enum imported in two places 
 within the same program prevents compilation.
Thanks. I need reproducible test case, there's too much guesswork needed on my part in the bug report.
The [new bug referenced in this thread](https://issues.dlang.org/show_bug.cgi?id=23622) indicates that this is probably specific to including math.h. I added a comment to the bug report, but here's the full test case: foo.c ``` #include <math.h> int main() {} ``` Compiles with gcc. DMD gives ``` #defines(797): Error: variable `foo.FP_NAN` conflicts with enum member `__anonymous.FP_NAN` at /usr/include/math.h(855) #defines(798): Error: variable `foo.FP_INFINITE` conflicts with enum member `__anonymous.FP_INFINITE` at /usr/include/math.h(858) #defines(799): Error: variable `foo.FP_ZERO` conflicts with enum member `__anonymous.FP_ZERO` at /usr/include/math.h(861) #defines(800): Error: variable `foo.FP_SUBNORMAL` conflicts with enum member `__anonymous.FP_SUBNORMAL` at /usr/include/math.h(864) #defines(801): Error: variable `foo.FP_NORMAL` conflicts with enum member `__anonymous.FP_NORMAL` at /usr/include/math.h(867) ```
Jan 12 2023
prev sibling next sibling parent Krzysztof =?UTF-8?B?SmFqZcWbbmljYQ==?= <krzysztof.jajesnica gmail.com> writes:
On Wednesday, 11 January 2023 at 02:59:49 UTC, Walter Bright 
wrote:
 Many have mentioned on the n.g. that ImportC wasn't working 
 with this or that .h file. So I've been looking at bugzilla for 
 issues pertaining to that.

 Pretty much they are contributions from Jacob Carlborg. I'm 
 halfway through fixing those.

 But what about yours? I can't fix non-specific things like 
 "doesn't work with h files". Help me help you by filing 
 bugzilla issues! Please tag them with the "ImportC" keyword.
On Linux anything which includes math.h or uses the assert macro from assert.h fails to compile: - https://issues.dlang.org/show_bug.cgi?id=23622 - https://issues.dlang.org/show_bug.cgi?id=23509
Jan 12 2023
prev sibling parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 1/10/23 18:59, Walter Bright wrote:

 Please tag them with the "ImportC" keyword.
Yesterday, I identified 2 issues with subjects starting with ImportC. I added the keyword to those issues. Ali
Jan 12 2023