C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem using C++ classes with AIX xlc Version 5.0

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
ChrisG
Guest





PostPosted: Mon Nov 28, 2005 11:25 pm    Post subject: problem using C++ classes with AIX xlc Version 5.0 Reply with quote



Hi,

I am building an executable on a bunch of UNIX platforms. It works on
all the other ones
(HP, Linux, SUN, SGI) but fails to run on Aix with xlc compiler version
5.0. The problem
is that the default constructors of my global objects are not called on
this platform. So
I declared my global object as

SymbolTable globalSymTab ;

and SymbolTable.cpp has

SymbolTable::SymbolTable ()
: m_curId (0),
m_htab (hTabSize),
m_offStr (0),
m_type (0) {
}

while SymbolTable.hpp has

class SymbolTable {

public:

SymbolTable ();
...
}

But the constructor SymbolTable::SymbolTable () is never called. Could
anyone give
me some suggestions on this problem?

Thanks in advance,
Chris

Back to top
Thomas Tutone
Guest





PostPosted: Mon Nov 28, 2005 11:39 pm    Post subject: Re: problem using C++ classes with AIX xlc Version 5.0 Reply with quote




ChrisG wrote:
Quote:
Hi,

I am building an executable on a bunch of UNIX platforms. It works on
all the other ones
(HP, Linux, SUN, SGI) but fails to run on Aix with xlc compiler version
5.0. The problem
is that the default constructors of my global objects are not called on
this platform. So
I declared my global object as

SymbolTable globalSymTab ;

and SymbolTable.cpp has

SymbolTable::SymbolTable ()
: m_curId (0),
m_htab (hTabSize),
m_offStr (0),
m_type (0) {
}

while SymbolTable.hpp has

class SymbolTable {

public:

SymbolTable ();
...
}

But the constructor SymbolTable::SymbolTable () is never called. Could
anyone give
me some suggestions on this problem?

Hard to tell without more info. Given that you are using global
variables and your code works on some platforms but not others, It is
possible that you are falling victim to the static initialization order
fiasco - in which case, you will find the following FAQ entries
helpful:

http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12

Best regards,

Tom


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.