From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15562 invoked by alias); 20 Dec 2002 01:40:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 15539 invoked by uid 61); 20 Dec 2002 01:40:05 -0000 Date: Thu, 19 Dec 2002 17:40:00 -0000 Message-ID: <20021220014005.15538.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, hablack@vt.edu, nobody@gcc.gnu.org From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, hablack@vt.edu, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c++/7769: using static libraries sometimes loses static initialization X-SW-Source: 2002-12/txt/msg01056.txt.bz2 List-Id: Synopsis: using static libraries sometimes loses static initialization State-Changed-From-To: open->closed State-Changed-By: bangerth State-Changed-When: Thu Dec 19 17:40:05 2002 State-Changed-Why: This is not a bug. When you want that a particular object file (possibly within an archive) is pulled into you executable for sure, then you have to reference an object inside it. If you rename your class "A" to "ComplexClass", to make its symbols better visible in the executable, you see that the object file with the static constructor is not even pulled into the executable: g/static_init> nm main1 | grep ComplexClass 080485f0 W __12ComplexClass g/static_init> nm main2 | grep ComplexClass g/static_init> nm main3 | grep ComplexClass g/static_init> nm main4 | grep ComplexClass 080485f0 W __12ComplexClass I guess this is just how the linker works. W. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7769