delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/25/13:55:35

X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Sun, 25 Mar 2001 20:53:52 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: DJGPP list <djgpp AT delorie DOT com>
Subject: Re: help - collect2.exe not linking element from a library
In-Reply-To: <7263-Sun25Mar2001202922+0200-eliz@is.elta.co.il>
Message-ID: <Pine.LNX.4.10.10103252051430.15102-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 25 Mar 2001, Eli Zaretskii wrote:

> > From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
> > Newsgroups: comp.os.msdos.djgpp
> > Date: 25 Mar 2001 16:12:19 GMT
> > 
> > Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> > [...]
> > > You forgot that ld.exe is a one-pass linker: it only scans the
> > > libraries once, in the order you specify them in the link command
> > > line.  
> > 
> > Hmmm... but isn't this true only for those libraries you specify with
> > -l arguments? Libs given by actual filename (like the OP's
> > c:/.../libmwin.a) are treated like .o files, and those are not subject
> > to one-pass-only treatment, AFAIK.
> 
> Are you saying that if I use libc.a instead of -lc, the linker pulls
> the _entire_ library into the executable?  That would be the only way
> it could work around its one-pass nature.  I doubt that the linker
> does that, though.

Turns out Eli's right, as usual. -lname is exactly equivalent to passing
the full name /some/directory/name/libname.a, including the fact that
it'll only be parsed once, at the place it occurs.

So, to overcome the OP's problem, the --( --) approach or repeated listing
of the same library is, indeed, necessary.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019