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

Sean Kelly sean at
Sat Feb 25 07:55:28 PST 2012

Be aware that if you use an archiver to put these files in a library you'll overwrite one. The command to preserve path name that the archiver provides on some OSes doesn't exist everywhere. 

On Feb 25, 2012, at 7:09 AM, "Martin Nowak" <dawg at> wrote:

> On Wed, 22 Feb 2012 22:33:35 +0100, Bernard Helyer <b.helyer at> 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