From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24983 invoked by alias); 17 Nov 2003 23:18:24 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 24924 invoked from network); 17 Nov 2003 23:18:23 -0000 Received: from unknown (HELO ns1.nec.com.au) (147.76.180.1) by sources.redhat.com with SMTP; 17 Nov 2003 23:18:23 -0000 Received: from smtp2.nec.com.au (smtp2.internal.nec.com.au [172.31.8.19]) by ns1.nec.com.au (8.11.6/8.11.6) with ESMTP id hAHNILb23975; Tue, 18 Nov 2003 10:18:23 +1100 Received: from deer.dd.nec.com.au (localhost.localdomain [127.0.0.1]) by smtp2.nec.com.au (8.12.8/8.12.8) with ESMTP id hAHNIGDO022759; Tue, 18 Nov 2003 10:18:16 +1100 Received: from dvalin (dvalin.dd.nec.com.au [147.76.212.105]) by deer.dd.nec.com.au (8.12.5/8.12.5/Debian-1) with ESMTP id hAHNIG5w021608; Tue, 18 Nov 2003 10:18:16 +1100 Received: from dvalin.dd.nec.com.au (localhost [127.0.0.1]) by dvalin (8.12.3/8.12.3/Debian-5) with ESMTP id hAHNEXTg001581; Tue, 18 Nov 2003 10:14:33 +1100 Received: (from erik@localhost) by dvalin.dd.nec.com.au (8.12.3/8.12.3/Debian-5) id hAHNEXVa001579; Tue, 18 Nov 2003 10:14:33 +1100 Date: Mon, 17 Nov 2003 23:18:00 -0000 From: Erik Christiansen To: Bo Do Cc: gcc-help@gcc.gnu.org Subject: Re: How handle static libraries? Message-ID: <20031117231433.GA1024@dd.nec.com.au> References: <000801c3aceb$a6d0ce20$2bfb0ec2@flygp.se> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <000801c3aceb$a6d0ce20$2bfb0ec2@flygp.se> User-Agent: Mutt/1.3.28i X-SW-Source: 2003-11/txt/msg00230.txt.bz2 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