[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] linking libraries in C



>
> Lot's of things e.g. SDL, GTK+ come with little scripts to add to your
> command line e.g.:
>
> will [at] dogfox:~$ gtk-config --libs
> -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl
> -lXi  -lXext -lX11 -lm
>
> As to whether it is worth writing teh script you mentioned, I'm not sure.
> The  pain of changing the Makefile is pretty minimal when compared to the
> pain of  writing the code in the first place. :)

...and there's the added complexity of some functions such as crypt(3). In
libc5, crypt() was part of the library, so any programs requiring crypt could
be linked against libc with no extra libraries. glibc2, OTOH, doesn't have
crypt() in the main libc library, thus requires linking against libcrypt (-
lcrypt) for access to crypt.

So it also comes down to: how portable do you want such a script to be? Linux
with glibc2? All Linux or all UNIX? You'll have real fun if the latter :)
(socket libraries? on solaris you need -lsocket and -lnsl ... not needed on
Linux ...)

Man pages can give a good idea (to a point), though they aren't kept up to
date (silly GNU "man pages are obsolete"). The info docs for GNU stuff might
be better. It's usually a case of RTFM, but if all else fails, as Will says,
guess :)

Chris...

-- 
\ Chris Johnson                 \
 \ cej [at] nightwolf.org.uk          \
  \ http://cej.nightwolf.org.uk/  ~-----------------------------------+
   \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____



___________________________________________________________________

Sheffield Linux User's Group - http://www.sheflug.co.uk . 
To unsubscribe from this list send mail to 
shef-lug-request@list.sheflug.org.uk with the word
"unsubscribe" in the body of the message. 

  GNU the choice of a complete generation.