Strange behaviour of rdmd vs. dmd concerning main function

berni via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 9 08:20:29 PST 2017


> dmd only compiles in the files you actually pass to it. rdmd 
> will try to find the required files automatically.
>
> Since you didn't pass the file with the function to dmd, it 
> knows it exists, but leaves it out of the final link (it 
> assumes it might come from a library or something). That's why 
> you see the error.

Ah ok, I understand. So calling with "dmd Special/special.d 
Common/common.d" works.

But when I compile common.d to common.o (with dmd -c common.d) 
and remove common.d after that is there still a possibility to 
link? The obvious doesn't work:

>$> dmd Special/special.d Common/common.o Special/special.d(4): 
>Error: module common is in file 'common.d' which cannot be read
>import path[0] = /usr/include/dmd/phobos
>import path[1] = /usr/include/dmd/druntime/import



More information about the Digitalmars-d-learn mailing list