-defaultlib flags

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Mar 23 15:02:42 PDT 2016


Hi Russel,

On 20 Mar 2016, at 4:57, Russel Winder via digitalmars-d-ldc wrote:
> […] I tried removing the -defaultlib option from the link and 
> replaced it
> with: -L-lphobos2-ldc

-defaultlib/-debuglib are mainly intended to be used for setting 
defaults from the config file. To disable that and only use the 
explicitly specified libraries, you can pass it with an empty argument.

> I am clearly misunderstanding something about dynamic linking and the
> -defaultlib here, and in particular the difference between dmd and
> ldc2.

The difference is that DMD parses any `-l` arguments and ignores `lib` 
prefixes, `.so` suffixes and on `.a` suffixes passes `-Bstatic` to the 
linker before the respective `-l` argument.

> Is this a simple issue I am missing, or is it something needing
> detail research?

LDC does not currently implement a way to specifically switch between 
statically/dynamically linking the standard library. You can either 
manually specify `-L-Bstatic`, or have a look at 
https://github.com/ldc-developers/ldc/pull/1305.

Best,
David


More information about the digitalmars-d-ldc mailing list