This is the mail archive of the
cygwin
mailing list for the Cygwin project.
g++ 3.4.4: all global constructors in archive not called
- From: Patric Ljung <plg at itn dot liu dot se>
- To: cygwin at cygwin dot com
- Date: Tue, 20 Feb 2007 21:50:08 +0100
- Subject: g++ 3.4.4: all global constructors in archive not called
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/