Why return to ar
and ranlib
silliness when you've had a
taste of libtool? Well, sometimes it is desirable to create a static
archive that can never be shared. The most frequent case is when you
have a "convenience library" that is a collection of related object
files without a really nice interface.
To do this, you should ignore libtool entirely, and just use the old
ar
and ranlib
commands to create a static library.
If you want to install the library (but you probably don't), then you may use libtool if you want:
burger$ libtool ./install-sh -c libhello.a /local/lib/libhello.a ./install-sh -c libhello.a /local/lib/libhello.a ranlib /local/lib/libhello.a burger$
Using libtool for static library installation protects your library from
being accidentally stripped (if the installer used the `-s' flag),
as well as automatically running the correct ranlib
command.
Another common situation where static linking is desirable is in creating a standalone binary. Use libtool to do the linking and add the `-static' flag.
Go to the first, previous, next, last section, table of contents.