[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: GTK static libs
- From: Erik Mouw <J A K Mouw its tudelft nl>
- To: gtk-app-devel-list redhat com
- Subject: Re: GTK static libs
- Date: Wed, 2 Feb 2000 17:36:31 +0100 (MET)
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/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]