View previous topic :: View next topic |
Author |
Message |
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Mon Sep 25, 2006 4:54 pm Post subject: -od option in 3.03 |
|
|
I just upgraded and it appears that -od now works, but it dumps all object files in the specified directory instead of preserving path structure. Consider this example:
Code: | module hello;
import liba.c;
import libb.c;
void main() {} |
Given "build hello -odc:\temp" I assume Build would generate "c:\temp\c.obj" for "liba.c" and then overwrite it with "c:\temp\c.obj" for "libb.c." It would be better if the files generated were "c:\temp\liba\c.obj" and "c:\temp\libb\c.obj," just as they were found in the search path. |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Mon Sep 25, 2006 5:54 pm Post subject: Re: -od option in 3.03 |
|
|
sean wrote: | I just upgraded and it appears that -od now works, but it dumps all object files in the specified directory instead of preserving path structure. Consider this example:
Code: | module hello;
import liba.c;
import libb.c;
void main() {} |
Given "build hello -odc:\temp" I assume Build would generate "c:\temp\c.obj" for "liba.c" and then overwrite it with "c:\temp\c.obj" for "libb.c." It would be better if the files generated were "c:\temp\liba\c.obj" and "c:\temp\libb\c.obj," just as they were found in the search path. |
I agree, but this is the behaviour of DMD. I thought about doing it better but I relented and did the same as DMD does. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Mon Sep 25, 2006 10:44 pm Post subject: |
|
|
Hrm... what about if -op is specfied to preserve path names? |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Mon Sep 25, 2006 11:01 pm Post subject: |
|
|
sean wrote: | Hrm... what about if -op is specfied to preserve path names? |
DMD ignores -op if -od is used. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Tue Sep 26, 2006 9:32 am Post subject: |
|
|
Hrm, i just tried this:
Quote: | C:\code\src\d>dmd test\test.d -odc:\temp -op
Error: Error writing file 'c:\temp\test\test.obj'
C:\code\src\d> |
So the combination of -od and -op seems to work as desired (on Windows at any rate) but for the creation of the destination directory if it doesn't exist. I'm tempted to file this as a bug, similar to how some folks want -D and -I to do the same thing. |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Tue Sep 26, 2006 4:20 pm Post subject: |
|
|
sean wrote: | Hrm, i just tried this:
Quote: | C:\code\src\d>dmd test\test.d -odc:\temp -op
Error: Error writing file 'c:\temp\test\test.obj'
C:\code\src\d> |
So the combination of -od and -op seems to work as desired (on Windows at any rate) but for the creation of the destination directory if it doesn't exist. I'm tempted to file this as a bug, similar to how some folks want -D and -I to do the same thing. |
Oh! Ok, my testing of D might have been faulty. One issue I do remember coming across was what do I do about this ...
-od c:\temp -op
but finding these modules ...
c:\module\foo.d;
d:\something\else\xyz.d;
I thought I might do this ...
c:\temp\c\module\foo.obj
c:\temp\d\something\else\xyz.obj
What do you think? _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Wed Sep 27, 2006 6:16 am Post subject: |
|
|
sean wrote: | Hrm, i just tried this:
Quote: | C:\code\src\d>dmd test\test.d -odc:\temp -op
Error: Error writing file 'c:\temp\test\test.obj'
C:\code\src\d> |
So the combination of -od and -op seems to work as desired (on Windows at any rate) but for the creation of the destination directory if it doesn't exist. I'm tempted to file this as a bug, similar to how some folks want -D and -I to do the same thing. |
Oh! Ok, my testing of D might have been faulty. One issue I do remember coming across was what do I do about this ...
-od c:\temp -op
but finding these modules ...
c:\module\foo.d;
d:\something\else\xyz.d;
I thought I might do this ...
c:\temp\c\module\foo.obj
c:\temp\d\something\else\xyz.obj
What do you think? _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Thu Oct 05, 2006 8:48 pm Post subject: |
|
|
sean wrote: | Hrm, i just tried this:
Quote: | C:\code\src\d>dmd test\test.d -odc:\temp -op
Error: Error writing file 'c:\temp\test\test.obj'
C:\code\src\d> |
So the combination of -od and -op seems to work as desired (on Windows at any rate) but for the creation of the destination directory if it doesn't exist. I'm tempted to file this as a bug, similar to how some folks want -D and -I to do the same thing. |
I'm afraid that DMD is not quite doing what we'd like it to do. If you use just the -od and not the -op then all object files are created in the -od directory, regardless of where the source files exist. If you add the -op switch is only applies that to source file specification that are 'relative' to the current directory. It does not apply to any source specification that contains a drive letter or leading '\'.
Code: |
dmd c:\foo\bar.d -odc:\temp -op
|
That will create the object file in c:\foo\bar.obj
Code: |
dmd foo\bar.d -odc:\temp -op
|
That will create the object file in c:\temp\foo\bar.obj
This effect is further hightlighted when imported files actually come from drives other than the file that imports them. In short, DMD does not do want we'd like it to do. And I can't control precisely where the object files are going to be created unless I am prepared to copy source files around to 'set up' the right paths.
This probably applies to linux too. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
|