FW: libtool devel package still dll crippled.

Ralf Habacker kde-cygwin@mail.kde.org
Sun, 21 Apr 2002 19:16:10 +0200


> From: Waldo Bastian [mailto:bastian@kde.org]
> Sent: Thursday, April 18, 2002 10:39 PM
> To: Ralf Habacker; Cygwin-Apps
> Subject: Re: FW: libtool devel package still dll crippled.
>
>
> On Thursday 18 April 2002 01:14 pm, Ralf Habacker wrote:
> > Hi Waldo,
> >
> > currently some guys are porting libtool to cygwin and have troubles with
> > static libs in multiple dll's and they like to hear how this is solved in
> > linux. Perhaps if you can't answer these question, please send it to
> > somebody who can.
> >
> > 1. When someone build a shared lib on linux and uses a static lib, are the
> > symbols of the static lib automatically  exported ?
>
> Yes, using a static lib is no different than compiling that code
> directly into
> your codebase.
>
> > 2a. If yes, and if someone build a second dll with the same static lib, the
> > symbols of the static libs are in both
> > shared lib defined. Then if someone uses these two shared libs to build for
> > example an application, ld fails with duplicated symbol errors. How does ld
> > prevent this ?
>
> ld checks the symbols in the shared libs during compile time to see if it can
> resolve all symbols and appearantly also detects duplicated symbols. On Linux
> it is not necassery impossible to have two libs that define the same symbols.
> E.g. this feature can be used to override the malloc implementation of libc.
> Of course when this happens inadvertently it can lead to unexpected
> behaviour/crashes. ELF (The linking format used on Linux) has rather complex
> rules for determining which symbol should be used if it is defined multiple
> times. It also distinguishes between weak and strong symbols. It might be
> that it is only possible to override weak-symbols and that multiple
> strong-symbols result in link-errors.
>
> It is not recommended to use a static lib and include it in multiple shared
> libraries. I know that kicker did this at one point, but that should have
> been fixed since.
>
> More info on ELF can be found on http://www.caldera.com/developers/gabi/
>
> Cheers,
> Waldo
> --
> bastian@kde.org  |   SuSE Labs KDE Developer  |  bastian@suse.com
>