On Wednesday, 1 May 2019 at 22:35:12 UTC, ag0aep6g wrote:
[...]
Or use -i so that DMD compiles the imported module automatically:

    dmd -unittest -main -i -run package.d

Now I have:

a/main.d
a/b/package.d
a/b/c/package.d

b/package.d and c/package.d as before. a/main.d is

```
import b;

void dummy ()
{
   string s = "test";
   mkdir (s);
}
```

In cwd a/ with

   $ dmd -unittest -main -i -run main.d

I get

b/package.d(2): Error: module `c` is in file 'c.d' which cannot be read
   import path[0] = /.../dmd2/linux/bin64/../../src/phobos
import path[1] = /.../dmd2/linux/bin64/../../src/druntime/import

Why does dmd not get it? I have to supply -I=b explicitly. Which leads me to
the actual problem I wanted to post:

   $ dmd -unittest -main -I=b -run main.d
   main.d(6): Error: undefined identifier mkdir

The problem I see here is that b passes the isolated unittest. But when it is used undefined symbols show up. I stumbled over this problem while using a project as submodule which uses msgpack-d as its submodule. Only if I restrict
the import like in

   import msgpack : unpack, pack;

my submodule's unittest fails right away. My submodule corresponds to b/package.d in this thread. I suppose the line

    package import std.file, core.stdc.string;

in msgpack-d's file packer.d causes the export of mkdir. Right?

Reply via email to