From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2206 invoked by alias); 6 Dec 2002 07:06:17 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 2199 invoked from network); 6 Dec 2002 07:06:16 -0000 Received: from unknown (HELO mallaury.noc.nerim.net) (62.4.17.82) by sources.redhat.com with SMTP; 6 Dec 2002 07:06:16 -0000 Received: from kapu.home.fr (harri.net1.nerim.net [62.212.97.71]) by mallaury.noc.nerim.net (Postfix) with ESMTP id 1812B62D08 for ; Fri, 6 Dec 2002 08:06:15 +0100 (CET) Content-Type: text/plain; charset="us-ascii" From: Harri Pasanen Reply-To: harri.pasanen@trema.com To: gcc@gcc.gnu.org Subject: dlopen() does not call static constructors on HP-UX Date: Thu, 05 Dec 2002 23:24:00 -0000 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200212060806.14016.harri@nerim.net> X-SW-Source: 2002-12/txt/msg00330.txt.bz2 I suppose this is an old can of worms, but after multiple searches through the mailing list I'm still not enlightened in my specific problem, so here I go. Looks like on HP-UX 11.00, using g++ 3.2, when I link against a shared library containing static objects, their constructors are called. But if I do dlopen(), or shl_load() for the shared library, the static objects are not initialized. Now seems like a HP-UX specific bug, and searching gnats it indeed looks like the same one as PR 8360. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8360 Having full control of the dlopen(), which happens in my C++ source, I'm looking for a way to manually circumvent this bug. Examining my shared library symbols, looks like there is something called __static_initialization_and_destruction, which I guess arranges for the constructors and destructors to be called. Is there a way I can arrange my code to call this function after I've done the dlopen()? Regards, Harri