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

Re: Questions on shared libraries



"Susan G. Kleinmann" <sgk@kleinmann.com> writes:

>     gcc -fpic -O2 -Wall -I<whatever_you_need> -c libprogram.c 
>     gcc -shared -Wl,-soname,libprogram.so.N -o libprogram.so.N.M.O lib*.o 
>     ln -s libprogram.so.N.M.O libprogram.so.N 
>     ln -s libprogram.so.N libprogram.so  

The second link should also be to the actual shared lib.  The .so file
is only for compiling, so goes into -dev.  See chapter 12 of package
manual.

The soname must match for a library to link.  Beyond that, the other
numbers can mean whatever you want, though upward compatibility is
expected.

Since this is a new library, and the only executables that will use it
are likely to be those netpbm, you can version it however you wish. I
would suggest N=1, M=0, and do without an O.

> 2.  Why do we distribute static libraries as well as shared libraries?

So people can compile static binaries of course!  Note that the static
library should be comprised of object files linked without -fpic.  In
other words each .c file is compiled twice.



Guy


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: