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

H. S. Teoh hsteoh at
Wed Feb 22 16:08:20 PST 2012

On Wed, Feb 22, 2012 at 05:05:40PM -0500, Jonathan M Davis wrote:
> On Wednesday, February 22, 2012 22:33:35 Bernard Helyer 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.

The real solution is that when creating object files, dmd should put the
.o files in the modules' respective subdirectories. I.e., it should keep
the pathname component of every source file and use that for the object
file. Then you have a 1-to-1 mapping between source files and object

Either that, or duplicate the source tree structure in an object tree
(if you like that kind of compile structure -- some projects do that).

Everything else is just a hack and prone to errors.


My program has no bugs! Only unintentional features...

More information about the Digitalmars-d mailing list