Bug 24418 – ImportC: can't import C file with fully qualified name if C file on the command line

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-02-28T08:22:06Z
Last change time
2024-12-13T19:33:34Z
Keywords
ImportC
Assigned to
No Owner
Creator
Atila Neves
Moved to GitHub: dmd#18217 →

Comments

Comment #0 by atila.neves — 2024-02-28T08:22:06Z
--------- // source/foo/bar/quux.c int twice(int i) { return i * 2; } // source/mod.d import foo.bar.quux; --------- % dmd -c -Isource source/mod.d # fine % dmd -c -Isource source/mod.d source/foo/bar/quux.c source/mod.d(1): Error: module `quux` from file source/foo/bar/quux.c must be imported with 'import quux;' It doesn't help that one can't explicitly declare the module name since quux.c is a C file.
Comment #1 by bugzilla — 2024-02-28T21:27:37Z
The following command will work: dmd -c -Isource source/mod.d -mv=foo.bar.quux=source/foo/bar/quux.c and will compile source/mod.d However, you'll still need to compile quux.c separately with: dmd -c source/foo/bar/quux.c
Comment #2 by robert.schadek — 2024-12-13T19:33:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18217 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB