From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11598 invoked by alias); 11 May 2004 16:18:25 -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 11583 invoked from network); 11 May 2004 16:18:24 -0000 Received: from unknown (HELO smtp-relay-7.sea.adobe.com) (192.150.22.7) by sourceware.org with SMTP; 11 May 2004 16:18:24 -0000 Received: from inner-relay-3.corp.adobe.com (inner-relay-3 [153.32.251.51]) by smtp-relay-7.sea.adobe.com (8.12.10/8.12.10) with ESMTP id i4BGILSP019558; Tue, 11 May 2004 09:18:21 -0700 (PDT) Received: from iplan-mn (iplan-mn.corp.adobe.com [130.248.25.5]) by inner-relay-3.corp.adobe.com (8.12.9/8.12.9) with ESMTP id i4BGIFkq010234; Tue, 11 May 2004 09:18:15 -0700 (PDT) Received: from conversion-daemon.iplan-mn.corp.adobe.com by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) id <0HXK00B014DRM7@iplan-mn.corp.adobe.com> (original mail from eljay@adobe.com); Tue, 11 May 2004 11:18:15 -0500 (CDT) Received: from mn-eljayet.adobe.com ([130.248.178.70]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0HXK005BJ5ADER@iplan-mn.corp.adobe.com>; Tue, 11 May 2004 11:18:15 -0500 (CDT) Date: Tue, 11 May 2004 16:18:00 -0000 From: Eljay Love-Jensen Subject: Re: static vs. dynamic libraries In-reply-to: X-Sender: eljay@iplan-mn.corp.adobe.com To: "Conklin, Larry" , gcc-help@gcc.gnu.org Message-id: <6.0.3.0.2.20040511110839.0202eec8@iplan-mn.corp.adobe.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7BIT References: X-SW-Source: 2004-05/txt/msg00118.txt.bz2 Hi Larry, This is a VERY platform (OS + GCC version) sensitive way to solve the problem, as a target using GNU Make (I presume you know where the tabs go): myfoo : foo.cpp $(CXX) -o $@ $^ \ -nodefaultlibs \ -Wl,-Bstatic \ $(shell $(CXX) -print-file-name=libstdc++.a) \ $(shell $(CXX) -print-file-name=libgcc.a) \ $(shell $(CXX) -print-file-name=libgcc_eh.a) \ -Wl,-Bdynamic \ -lpthread -lc -lm -ldl CAVEAT: Use with caution! This may work on, say, Solaris, and be completely wrong for, say, AIX or Linux. And the libraries may be correct for GCC 3.2, and wrong for GCC 3.3. Your mileage may vary. HTH, --Eljay