Global object initialisation doesn't work ??

James E Wilson wilson@specifixinc.com
Wed Nov 10 03:16:00 GMT 2004


kavii ita wrote:
> My g++ compiler doesn't generate the .ctor and dtor
> sections. 

There are many different ways to implement static constructors, and many 
different things that can go wrong.  Without more info, we can't do 
anything to help you.

We need to know what the target is.  We need to know how you are 
compiling it.  We need to know what if any changes you have made to gcc. 
  Etc.  We need to know everything necessary in order for one of us to 
reproduce the problem you are seeing.

Using gcc-3.3.3, the testcase works for me on an x86_64-linux system.  I 
don't see anything obviously wrong.

 >I came to know that crtbegin, crtend ojects are needed
 >to be linked for c++. Is this right?

For most ELF targets, yes.  But the compiler takes care of this for you, 
so this isn't something you should need to worry about.  Unless maybe 
you are writing your own port, but you didn't mention that.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list