how do I pass --whole-archive and --no-whole-archive to dub?

Andre Pany andre at
Fri Aug 7 18:11:13 UTC 2020

On Thursday, 6 August 2020 at 19:31:01 UTC, Andrei Alexandrescu 
> On 8/6/20 2:19 PM, rikki cattermole wrote:
>> In theory it should be as simple as setting it in lflags.
>> But you will need to test it, as I'm not sure if it'll 
>> propagate upwards to where you need it.
>> If that doesn't work, having dub automatically handle 
>> registration functions would be a nice feature request to have.
> I did try this:
> lflags "--whole-archive" "/path/to/libmylib.a" 
> "--no-whole-archive"
> But that doesn't work, presumably because the command line 
> contains the same library before these flags. So I assume the 
> first occurrence is taken and the second ignored.
> As an aside, it is very irritating that dub multiplies the 
> flags for some reason, e.g. appears 
> literally 30 times in the same command line. Similar for other 
> flags.

I am not an expert in this area, just thinking loud: dub could 
recognize the `--whole-archive`, `--no-whole-archive` pattern in 
lflags and add it also to the first occurrence of the lib file in 
the command line.

This should be a rather simple fix?

Kind regards

More information about the Digitalmars-d mailing list