This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How handle static libraries?
- From: Erik Christiansen <erik at dd dot nec dot com dot au>
- To: Bo Do <bodo at flygp dot se>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 18 Nov 2003 10:14:33 +1100
- Subject: Re: How handle static libraries?
- References: <000801c3aceb$a6d0ce20$2bfb0ec2@flygp.se>
On Mon, Nov 17, 2003 at 10:17:41AM +0100, Bo Do wrote:
> My question is, I have a library C which needs/uses library A. Can I
> compile/archive C in some way so that when I want to use C in a
> program, I just include C.h and link in C?
From: man ar;
The GNU ar program creates, modifies, and extracts from
archives. An archive is a single file holding a collec
tion of other files in a structure that makes it possible
to retrieve the original individual files (called members
of the archive).
...
ar is considered a binary utility because archives of this
sort are most often used as libraries holding commonly
needed subroutines.
...
Haven't used it myself, but there should be examples of its use in the
makefiles for gcc, etc. (I've seen "ar" commands whiz by, and they
seemed to be doing roughly what you intend, as far as a fleeting glimpse
can tell.)
At least, it's worth a look.
Erik