Mail Archives: cygwin-apps/2001/11/21/18:21:33
On Wed, Nov 21, 2001 at 12:45:08PM -0500, Charles Wilson wrote:
> Corinna Vinschen wrote:
> > Isn't the functionality you're searching for already in ld given by
> > the --no-whole-archive options?
> >
> > gcc -shared -o cygfoo.dll $(OBJ)
> > -Wl,--out-implib,libfoo.dll.a
> > -Wl,--no-whole-archive -lbar -lbaz
> >
> > Or am I missing the point?
>
>
> the problem is, --no-whole-archive applies to EVERY library, even
> convenience libraries. For instance, a common autotools idiom is to
> create various convenience libraries libsubunit1.a and libsubunit2.a.
> These archives are intended to be included in the eventual .so (.dll)
> and the internal symbols of libsubunit*.a are INTENDED to be exported
> from that .so.
>
> --no-whole-archive makes this idiom impossible; it is not granular
> enough. Ralf's solution removes the whole purpose of the idiom --
> what's the use of a "convenience" library if you use --no-whole-archive
> and must then explicitly export every .o contained within the
> "convenience" library? You're better off not creating the "convenience"
> library at all, and just explicitly adding the various .o files to your
> link command line.
But isn't that the purpose of --whole-archive? In the above
example I can create the static libs libfoo1.a and libfoo2.a
from $(OBJ) and then call
gcc -shared -o cygfoo.dll
-Wl,--out-implib,libfoo.dll.a
-Wl,--whole-archive libfoo1.a libfoo2.a
-Wl,--no-whole-archive -lbar -lbaz
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin AT cygwin DOT com
Red Hat, Inc.
- Raw text -