www.delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <45DB5F00.5050501@itn.liu.se> |
Date: | Tue, 20 Feb 2007 21:50:08 +0100 |
From: | Patric Ljung <plg AT itn DOT liu DOT se> |
User-Agent: | Thunderbird 1.5.0.9 (Windows/20061207) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | g++ 3.4.4: all global constructors in archive not called |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Dear cygwin readers, I have just ported an application from Linux to Cygwin. In one archive (.a) I have several global constructors, 2-3 in two .o files. When I run my program only one initializer function is called in that archive. Leaving the other uninitialized/uncalled. I have found this issue reported in 2002, but there is no solutions posted in response to this question. http://sourceware.org/ml/cygwin/2002-07/msg00447.html To verify this problem I created a simple class and made a local global instance. The class name and output string was slightly different in the other file. class a_very_local_t { public: a_very_local_t() { printf("arbfragprog.cc: very_local_t::constructor\n"); _info = 0; } private: int _info; }; static a_very_local_t a_local_instance_a; When the program is started I only get the output from one of the .o files (the first alphabetically). It appears to me a rather fundamental issue that should have been solved years ago. Have I missed to provide the compiler/linker/archiver with an appropriate flag? Thanks in advance for your help. best regards / Patric -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |