Thread overview
How to handle differrnt modules which has same file name ?
Nov 20, 2007
z_axis
Nov 20, 2007
Regan Heath
Nov 20, 2007
Sascha Katzner
Nov 20, 2007
JScott
Nov 20, 2007
z_axis
November 20, 2007
For ezample, the directory is as below:
d:\src\p1\a.d
d:\src\p2\a.d

d:\src\test.d

import p1.a;
import p2.a;

void main(char[][] args) {
//...
}


d:\src\dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.d p2\a.d

compling is ok however cannot link !!!  because p2.a.obj will overwrite p1.a.obj. then there is only one a.obj in d:\src !!!
what is the best way to solve this problem ?


regards!
November 20, 2007
z_axis wrote:
> For ezample, the directory is as below:
> d:\src\p1\a.d
> d:\src\p2\a.d
> 
> d:\src\test.d
> 
> import p1.a;
> import p2.a;
> 
> void main(char[][] args) {
> //...
> }
> 
> 
> d:\src\dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.d p2\a.d
> 
> compling is ok however cannot link !!!  because p2.a.obj will overwrite p1.a.obj. then there is only one a.obj in d:\src !!!
> what is the best way to solve this problem ?

It seems odd to me that DMD is creating all object files in the execution path.  I remember having similar issues with make/cc on certain UNIX os's and having to use special makefile syntax to cause obj files to appear in the same directory as the source.

That is essentially what you want to do here, and you can do it by compiling each a.d file seperately, eg.

cd \src\p1
dmd -c a.d
cd \src\p2
dmd -c a.d
cd \src
dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.obj p2\a.obj

You should think about using a build tool like rebuild, bud, etc.  I would hope they can handle this sort of situation.

Regan
November 20, 2007
z_axis wrote:
> what is the best way to solve this problem ?

Build them separately in their directories (via -c) and at the end link
all together via:

dmd -oftest.exe test.obj p1\a.obj p2\a.obj

LLAP,
Sascha Katzner
November 20, 2007
z_axis Wrote:

> For ezample, the directory is as below:
> d:\src\p1\a.d
> d:\src\p2\a.d
> 
> d:\src\test.d
> 
> import p1.a;
> import p2.a;
> 
> void main(char[][] args) {
> //...
> }
> 
> 
> d:\src\dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.d p2\a.d
> 
> compling is ok however cannot link !!!  because p2.a.obj will overwrite
> p1.a.obj. then there is only one a.obj in d:\src !!!
> what is the best way to solve this problem ?
> 
> 
> regards!

I think you can solve this problem by using the -op option.
November 20, 2007
在 Tue, 20 Nov 2007 21:37:09 +0800,JScott <jrs7561@louisiana.edu> 写道:

> z_axis Wrote:
>
>> For ezample, the directory is as below:
>> d:\src\p1\a.d
>> d:\src\p2\a.d
>>
>> d:\src\test.d
>>
>> import p1.a;
>> import p2.a;
>>
>> void main(char[][] args) {
>> //...
>> }
>>
>>
>> d:\src\dmd -O -release -w -L/SUBSYSTEM:windows:5 test.d p1\a.d p2\a.d
>>
>> compling is ok however cannot link !!!  because p2.a.obj will overwrite
>> p1.a.obj. then there is only one a.obj in d:\src !!!
>> what is the best way to solve this problem ?
>>
>>
>> regards!
>
> I think you can solve this problem by using the -op option.

great !

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/