linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Steven" <sos22@cam.ac.uk>
To: David Wuertele <dave-gnus@bfnet.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Why does linking a.so with b.so require execs to be linked both -la and -lb?
Date: Tue, 12 Aug 2003 20:12:41 +0100	[thread overview]
Message-ID: <20030812191241.GA1063@archibold.chu.cam.ac.uk> (raw)
In-Reply-To: <m3r83qzv2j.fsf@bfnet.com>

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

> Glynn> One consequence of this difference is that Linux allows an
> Glynn> executable to export symbols to a library. Thus you can create
> Glynn> a library with unresolved references (i.e. symbols not provided
> Glynn> by either the library or any of it's explicit dependencies). So
> Glynn> long as that symbol actually gets provided at run-time (e.g. by
> Glynn> the executable itself), everything works.
> Does this "flexibility" have practical applications?
If it's combined with weak symbols it's often handy.  Suppose library
A arranges to libA_error whenever it suffers an error, which prints an
error message and terminates the program.  If the libA_error is weak,
then an application can define its own libA_error as a strong symbol,
which will then override the weak variant and be called in preference
to the library's own version.

Systems with multiple, incompatible, threading libraries, such as
FreeBSD, often do something similar with symbols be provided by the
application's chosen threading library.  This means that libA should
be able to work reasonably well whether the application uses libkse or
libthr, without the author of libA having to do anything special.

Steven Smith,
sos22@cam.ac.uk.

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

  parent reply	other threads:[~2003-08-12 19:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-11 21:02 Why does linking a.so with b.so require execs to be linked both -la and -lb? David Wuertele
2003-08-11 23:50 ` Mike Castle
2003-08-12  0:10   ` David Wuertele
2003-08-12 13:49     ` Glynn Clements
2003-08-12 16:42       ` David Wuertele
2003-08-12 17:54         ` Glynn Clements
2003-08-12 19:12         ` Steven [this message]
2003-08-12  0:11   ` David Wuertele
2003-08-12 13:16 ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030812191241.GA1063@archibold.chu.cam.ac.uk \
    --to=sos22@cam.ac.uk \
    --cc=dave-gnus@bfnet.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).