 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ChrisG Guest
|
Posted: Mon Nov 28, 2005 11:25 pm Post subject: problem using C++ classes with AIX xlc Version 5.0 |
|
|
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
|
Posted: Mon Nov 28, 2005 11:39 pm Post subject: Re: problem using C++ classes with AIX xlc Version 5.0 |
|
|
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 |
|
 |
|
|
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
|
|