Linking multiple libraries

A Guy With a Question aguywithaquestion at gmail.com
Sat Nov 25 22:40:49 UTC 2017


On Saturday, 25 November 2017 at 22:36:32 UTC, A Guy With a 
Question wrote:
> On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker 
> wrote:
>> 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.
>
> Yes. That also worked when I tried it.

Also when I said library, I'm actually talking about the dlls 
that are produced. I essentially have four projects in Visual D. 
Each produces a binary. 3 produce dlls and the final created the 
end exe.


More information about the Digitalmars-d-learn mailing list