linking-in libs under linux needed and not under windows

BBasile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 26 19:50:57 PDT 2015


let's say i have 'libA', 'libB' and 'Project'
- libB uses libA
- Project uses libB

under Windows (32 bit, OMF objects, Digital Mars linker, so the 
standard setup):
-------------

* libA is compiled with: dmd sourceA.d -lib
* libB is compiled with: dmd sourceB.d -lib -I<pathToSourceA>
* Project is compiled with: dmd sourceProject.d libA.lib libB.lib 
-I<pathToSourceA> -I<pathToSourceB>

and it just works fine

under Linux (64 bit, also the standard setup):
-----------

The same procedure fails with some messages ("undefined this and 
that...") but
if i link "incrementaly" (so i link libA in libB) it works:

* libA is compiled with: dmd sourceA.d -lib
* libB is compiled with: dmd sourceB.d libA.a -lib 
-I<pathToSourceA>
* Project is compiled with: dmd sourceProject.d libA.a libB.a 
-I<pathToSourceA> -I<pathToSourceB>


So the Q: Is this difference normal ?


Why I ask this ?
The problem is that I've made a change to Coedit recently that is 
based on the way it works on Windows:
https://github.com/BBasile/Coedit/blob/master/src/ce_nativeproject.pas#L373
That does that: libraries files are only passed when the output 
binary must contain everything (so an executable). The problem is 
verified with a lib which uses two Derelict libs that use 
themselves DerelictUtil...I could just put a compiler switch in 
the .pas source to have the right behaviour according to the 
platform but i'd like an explanation...this difference looks 
weird.


More information about the Digitalmars-d-learn mailing list