Poll: -od -lib -of and breaking compatibility with build tools

Nicholas Wilson iamthewilsonator at hotmail.com
Mon Aug 12 12:06:51 UTC 2019


On Monday, 12 August 2019 at 11:16:12 UTC, Joseph Rushton 
Wakeling wrote:
> On Monday, 12 August 2019 at 05:59:53 UTC, FeepingCreature 
> wrote:
>> DMD, when specifying -od (output directory), -of (output file) 
>> and *only* when in -lib mode, treats the output file path as 
>> relative to the output directory path. Ie. -odfoo -oflibbar.a 
>> results in foo/libbar.a as opposed to ./libbar.a. This is in 
>> contradiction to every other mode (-shared, binary output, 
>> object output) and every other D compiler (ldc, gdc).
>
> Is there any reason, other than arbitrariness, why this is so?

Consistency? ;-) Not that DMD has a good track record on that, 
hence this thread I guess.

> e.g. are there some circumstances where using the `-lib` flag 
> might result in more than one output file being generated 
> (which presumably need to wind up in the same dir)?

There are a couple of cases in LDC (e.g. if you specify multiple 
-output-* flags, dcompute, PGO(?)), but the only case, i think, 
for DMD is -mixin (which you only care about for debugging). 
There probably some weird arcane combo of flags that does 
something unexpected though.


More information about the Digitalmars-d mailing list