Bug 24669 – ImportC: C files are not compiled with '-i' flag

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-07-20T22:50:57Z
Last change time
2024-08-11T12:43:32Z
Keywords
ImportC, link-failure
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2024-07-20T22:50:57Z
Consider the following source code layout: ``` main.d foo.c ``` with files main.d: ``` import foo; void main(){ foo.foo(); } ``` foo.c: ``` extern int puts(const char*); void foo(void){ puts(“foo"); } ``` `dmd -i main.d` fails with undefined reference to `foo`, indicating that foo.c is not being compiled.
Comment #1 by dave287091 — 2024-07-20T23:00:27Z
https://issues.dlang.org/show_bug.cgi?id=24668 might block this as projects that currently work importing *.c files for decls only might stop working.
Comment #2 by ryuukk.dev — 2024-08-11T12:43:32Z
I fixed it here: https://github.com/dlang/dmd/pull/16776 PR got merged but i messed up the title so it didn't reference it