dmd -c behaviour doesn't take account of packages.

Martin Nowak dawg at dawgfoto.de
Sat Feb 25 07:09:10 PST 2012


On Wed, 22 Feb 2012 22:33:35 +0100, Bernard Helyer <b.helyer at gmail.com>  
wrote:

> A discussion on the Mono-D IRC channel just made me realise something.
>
>      dmd -c foo/a.d  bar/a.d
>
> The second module overwrites the first. This makes using 'pass  
> everything at once' with Mono-D (IDE plugin) difficult/impossible. As  
> far as I'm concerned, it's just a bug that's never come up. The solution  
> is trivial, of course. Prepend package names so you get foo_a.o and  
> bar_a.o. Either that or allow specific output paths to be specified  
> per-object. Or just produce one object file. Anything _but_ the current  
> behaviour, in fact.

use '-op' to preserve the directory structure
use '-od' to set the root directory

mkdir foo bar
echo "module foo.a;" > foo/a.d
echo "module bar.a;" > bar/a.d
dmd -c -op -odout foo/a.d bar/a.d
tree out
rm -r foo bar out


More information about the Digitalmars-d mailing list