[Developers] Link order of libraries
davef at otter-rsch.com
Sat May 2 08:44:03 PDT 2009
Arni Magnusson wrote:
The general rule would be that the order does not matter for Borland and
VC++, because their
linker will look backwards to find unsatisfied references.
The linker used with GCC only looks forward so the natural way tor der
the libraries is to put
liba before libb if liba refers to things in libb. Then if libb also
refers to things in liba you need to
put liba after libb as well in the list. So just in case it is easeir
to duplicate the list at least once
so that thee are no unsatisfied references because dependencies have a
tendency to slip into the
libraries over time.
Normally if thee are two identical symbols in the libraries lists for
Borland and VC++ I thought
you would get a warning message or an error. However maybe this is not
the case. Changing the order
presumably causes a different function to get included. Probably just by
comparing the map files for the
Borland linker you could see how the links differ.
> On Thu, 30 Apr 2009, Hans Julius Skaug wrote:
>> I do not know the "correct" way of linking in the libraries, but I
>> can confirm that ado32.lib adt32.lib admod32.lib adf1b2o.lib was the
>> order Dave used previously for the Borland version.
> I see. Here are the scripts I have access to:
> ADMB 5.0.1 for Borland 5.5, lnkadmb.bat (12-Feb-1999):
> admod32.lib adt32.lib ado32.lib
> ADMB 9.0.202 for Borland 5.5, lnkadmb.bat (15-Apr-2009):
> df1b2stub.lib admod32.lib adt32.lib ado32.lib
> ADMB 9.0.202 for Borland 5.5, lnkadmb-re.bat (15-Apr-2009):
> df1b2o.lib admod32.lib adt32.lib ado32.lib
> So for over 10 years, the Borland order has been [df1b2]-mod-t-o, and
> as far as I can tell, the Microsoft and GCC scripts have also been
> [df1b2]-mod-t-o through the years.
> Now, Jason bas pointed out that o-t-mod-df1b2 works better for Borland
> random effects, and Hans has seen this order somewhere before.
> Johnoel and I are going to update the user scripts, so the question is
> should we:
> 1. Change only Borland lnkadmb-re.bat to o-t-mod-df1b2, following
> Jason's finding. Everything works, and it doesn't really matter why.
> 2. Change only Borland lnkadmb-re.bat to mod-t-o-df1b2. This creates a
> larger executable, presumably because more functions are defined.
> 3. Change all Borland lnkadmb*.bat to o-t-mod-df1b2 or mod-t-o-df1b2.
> Perhaps Borland's rule for linking libraries is the opposite of GCC.
> The GCC rule is to read aloud "uses functions defined in" between the
> That's why I thought the original order df1b2-mod-t-o makes sense: RE
> uses ADMB uses AUTODIF.
> 4. Investigate this further, hopefully understanding why the GCC
> scripts repeat the libraries twice: df1b2-mod-t-o-df1b2-mod-t-o. Whey
> does GCC need repeating, if Borland and Microsoft don't? Being a GCC
> user myself, I find this even more interesting than the Borland issue.
> Developers mailing list
> Developers at admb-project.org
David A. Fournier
P.O. Box 2040,
Sidney, B.C. V8l 3S3
More information about the Developers