I've only tested this on Linux with GDC!
Two files:
foo.d
module foo;
private import bar;
int main ( char[][] args )
{
return 0;
}
bar.d
module bar;
private import foo;
void doSomething ( int i )
{
int j = i * 2;
}
These are just examples, it happens with two files which import each other.
Both files are (for example) in /home/florian/dev/d/tests/buildtest
If you run build in a subfolder ( /home/florian/dev/d/tests/buildtest/somefolder ) with the following command, build will give the file foo.d twice to the linker:
build ../foo.d -V
Output of stdout and stderr is attached.
Here the interesting part:
(...)
source file[0] ./../foo.d
source file[1] /home/florian/dev/d/tests/buildtest/bar.d
source file[2] /home/florian/dev/d/tests/buildtest/foo.d
(...)
Running '/usr/local/bin/gdc foo.o bar.o foo.o -o /home/florian/dev/d/tests/buildtest/foo -lc -lgphobos -lpthread -lm'
(...)