From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1972 invoked by alias); 8 May 2003 17:53:36 -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 1958 invoked from network); 8 May 2003 17:53:35 -0000 Received: from unknown (HELO crack.them.org) (146.82.138.56) by sources.redhat.com with SMTP; 8 May 2003 17:53:35 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 19DpaJ-0002BH-00; Thu, 08 May 2003 12:53:36 -0500 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 19DpZl-0007dw-00; Thu, 08 May 2003 13:53:01 -0400 Date: Thu, 08 May 2003 17:53:00 -0000 From: Daniel Jacobowitz To: "Pearson, Scott" Cc: 'Muthukumar Ratty' , "'gcc@gcc.gnu.org'" , "'gcc-help@gcc.gnu.org'" Subject: Re: __attribute__((constructor)), shared object files and C++... Message-ID: <20030508175301.GA29339@nevyn.them.org> Mail-Followup-To: "Pearson, Scott" , 'Muthukumar Ratty' , "'gcc@gcc.gnu.org'" , "'gcc-help@gcc.gnu.org'" References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-SW-Source: 2003-05/txt/msg00066.txt.bz2 On Thu, May 08, 2003 at 10:38:48AM -0700, Pearson, Scott wrote: > For the C++ case, I ended up with the (somewhat similar) sequence: > > > > g++ -fPIC -c libctest.cpp > > g++ -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 > libctest.o > > ldconfig -v -n . > > ln -sf libctest.so.1 libctest.so > > g++ -o ctest -L. -lctest -lstdc++ ctest.cpp > > > > This didn't work; the module constructors/destructors were not executed. > Where did I go wrong? Sorry, nothing obvious jumps out at me. You don't need the -lstdc++ in the last line though. g++ will take care of it. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer