Thread overview
ImportC and .h files
Jan 11, 2023
Walter Bright
Jan 11, 2023
bachmeier
Jan 12, 2023
Walter Bright
Jan 12, 2023
bachmeier
Jan 12, 2023
Ali Çehreli
January 10, 2023
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.
January 11, 2023
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.
January 11, 2023
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.
January 12, 2023
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
January 12, 2023

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 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)
January 12, 2023
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