Consider the following source code layout:
```
main.d
a/
foo.c
```
with files
main.d:
```
import a.foo;
void main(){
a.foo.foo();
}
```
a/foo.c:
```
extern int puts(const char*);
void foo(void){ puts(“foo”); }
```
`dmd main.d` fails due to undefined reference to foo (as a/foo.c is not compiled to object code). However, `dmd main.d a/foo.c` also fails with the error “module `foo` from file a/foo.c must be imported with ‘import foo;’”. In a D file you would declare “module a.foo;”, but there is no way to do that with ImportC.
Comment #1 by dave287091 — 2024-07-20T23:11:40Z
I think the fix is to just set the module name to the import path. In other words `a/foo.c` implies a `module a.foo;` declaration.
Comment #2 by robert.schadek — 2024-12-13T19:36:31Z