This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/54791] AIX-only: Constructors are not called in main program.
- From: "adivilceanu at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Nov 2012 14:45:59 +0000
- Subject: [Bug target/54791] AIX-only: Constructors are not called in main program.
- Auto-submitted: auto-generated
- References: <bug-54791-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54791
--- Comment #17 from Adi <adivilceanu at yahoo dot com> 2012-11-07 14:45:59 UTC ---
Finally I got it working. You are right, there are _GLOBAL* symbols generated
for each constructor, but only when you specify the init_priority attr for
that object. (otherwise there is just on _GLOBAL per file).
Also init_priority did not work previously on my side because of how I put it
in the code: "ClassName objName("some string") __attribute__ ((init_priority
(NNNN)));
I realized that I need to put the _attribute_ between the objName and ("some
string").
So now my whole project works with static libs.
Do you know what I can do for shared libs?
Can I take advantage of the -binitfini option on the lib to somehow set a
priority for the hole lib? I need a lib to initialize before the main exe gets
initialized.
Thanks !