Linking multiple libraries

Mike Parker aldacron at gmail.com
Sat Nov 25 22:31:10 UTC 2017


On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a 
Question wrote:

>
> That's how I set up the linking in Visual D. Everything builds. 
> But should the final exe try to link against all 3 libraries, 
> library 3 link to library 1 & 2 and library 2 link to library 1 
> (also builds)? Or is the single dependence chain I created work 
> without quirks?
>
> Is there a functional difference at the end of the day?

You don't link static libraries with each other. They're just 
collections of object files intended to be linked with an 
executable or a DLL. Order doesn't matter for optlink or the MS 
linker, but other linkers, such as ld (which is commonly used 
with GCC) require the libraries be passed in according to 
dependencies, e.g. dependent libraries come before their 
dependencies. Not sure if the LLVM linker retains that behavior.


More information about the Digitalmars-d-learn mailing list