[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
RE: GTK static libs
- From: "Timothy M. Shead" <tshead k-3d com>
- To: <gtk-app-devel-list redhat com>
- Subject: RE: GTK static libs
- Date: Wed, 2 Feb 2000 10:01:20 -0800
Dynamic linking:
gcc -o foo foo.o -lmydynamiclib
Static linking:
gcc -o foo foo.o libmystaticlib.a
(assumes you know the path to libmystaticlib.a)
Timothy M. Shead
tshead@k-3d.com
> -----Original Message-----
> From: Erik Mouw [mailto:J.A.K.Mouw@its.tudelft.nl]
> Sent: Wednesday, February 02, 2000 8:37 AM
> To: gtk-app-devel-list@redhat.com
> Subject: Re: GTK static libs
>
>
> On Tue, 01 Feb 2000 23:43:51 +0100 (CET), rsmith@xs4all.nl wrote:
> > On 30 Jan, Erik Mouw wrote:
> >> > 2. Is there a elegant method to compile one time with static, another
> >> > time with dynamic libs??
> >>
> >> Not that I'm aware of. Probably the elegant option doesn't
> exist because
> >> a) dynamic linking is the Right Thing [tm], and b) static
> linking is *very*
> >> OS/compiler dependent (-static won't work on SGI IRIX, for example).
> >
> > You can pass options to the linker on the GCC command line (with -Wl or
> > -Xlinker). According to the ld info pages you can use the -Bdynamic and
> > -Bstatic flags to link dynamically resp. statically to the library
> > following the switch. Is this what you mean? (haven't tried this,
> > though ;-)
>
> Yeah, I know, but then again: even the "-Wl,-Bstatic" flag is not
> portable, because the IRIX linker needs "-Wl,-B,static" (note the extra
> ",").
>
> The "-Bstatic" and "-Bdynamic" flags tell the linker to link the next
> librarieS (not the next librarY) following the switch static/dynamic. In
> that way you can actually choose which libraries you want static, and
> which dynamic. For example:
>
> gcc -o foo foo.o -Wl,-Bstatic -L/usr/X11R6/lib -lgtk -lgdk -rdynamic \
> -lgmodule -lglib -Wl,-Bdynamic -ldl -lXext -lX11 -lm
>
> links the GTK+ libs static, but the dynamic link, X11, and math libraries
> dynamic.
>
>
> Erik
>
> --
> J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
> of Electrical Engineering, Faculty of Information Technology and Systems,
> Delft University of Technology, PO BOX 5031, 2600 GA Delft, The
> Netherlands
> Phone: +31-15-2785859 Fax: +31-15-2781843 Email
> J.A.K.Mouw@its.tudelft.nl
> WWW: http://www-ict.its.tudelft.nl/~erik/
>
>
>
>
> --
> To unsubscribe: mail gtk-app-devel-list-request@redhat.com with
> "unsubscribe" as the Subject.
>
> Mailing list concerns should be mailed to <listmaster@redhat.com>
>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]