This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Global object initialisation doesn't work ??


Hello,
My g++ compiler doesn't generate the .ctor and dtor
sections. 
So the global obects in the code doesn't work. 
The following test case works.

When I see the objdump/readelf of the hello.c, it
shows the 
/ctor section coming empty.

how do put the [cd]tor section content in to the code
?
I am using 3.3. compiler.

I came to know that crtbegin, crtend ojects are needed
to be linked for c++. Is this right?
==============================================
hello.c
================================
#include <stdio.h>
int main () 
{
class A { 

public: 
A ()
{
  printf ("Public hello ! "); 
} 
};

A a;

}

================================
But this test case doesn't work.
================================

#include <stdio.h>

class A 
{ 
	public: 
	A ()
	{
	  printf ("Public hello ! "); 
	} 
};

A a;

int main () 
{ 

}
================================


-kavii


________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]