.obj files conflict

Sean Kelly sean at f4.ca
Tue Dec 26 14:20:22 PST 2006


Derek Parnell wrote:
> On Tue, 26 Dec 2006 16:53:47 +0000 (UTC), Nick Atamas wrote:
> 
>> I find that .obj files conflict when I use the -od flag to redirect
>> intermediate output to a directory. Shouldn't obj files get the name of their
>> package? So, sdl.timer.obj instead of just timer.obj.
>>
>> e.g.
>>
>> c:\proj> bud -odbin src/main.d
>> [proj]
>>   |--[bin]
>>   \--[src]
>>       |--[A]
>>       |  \--Timer.d
>>       |
>>       |--[sdl]
>>       |   \--timer.d
>>       |
>>       \--main.d  #imports and uses both timers
>>
>>
>> This will cause a linker error because bin/Timer.obj will be overwritten by
>> bin/timer.obj.
>>
>> This isn't just a problem on windows. If we had both lower-case names as in
>> A/timer.d and sdl/timer.d, there would still be a linker error.
> 
> By the way, this is not a problem caused by using Bud. It is a function of
> the way that DMD works.
>  
> For Bud to 'fix' this, it would either have to compile each source file
> seperately, adjustng the -od switch accordingly, or copy the entire source
> code structure to the root mentioned in the -od switch, compile all the
> copied source with the -op switch instead of -od, then delete the source
> copies.

I think the -od and -op flags can be used together, so the object files 
would all end up in subdirectories of bin.  Then it's simply a matter of 
recursively linking all object files in that tree.


Sean


More information about the Digitalmars-d-bugs mailing list