problem with initialization of global variable & objects
Pascal Degryze
pascal.degryze@traficon.com
Thu Aug 29 01:59:00 GMT 2002
Hi,
I am a new user of gcc-tools.
I've bought the GNU X-tools from Microcross for ARM-9 core.
It contains gcc version 2.95.2 / ld version 2.9.5.
I've encountered 2 problems:
1) initialization of global variables at runtime doesn work, so for this
example:
unsigned long LongVar = 123; // initialization doesn't happen
main()
{
LongVar ++; /* LongVar will not be 124, but dummy */
}
LongVar will have a dummy value. The initialisation must happen in main() to
work properly:
main()
{
unsigned long LongVar = 123;
LongVar ++; /* LongVar will not be 124, but dummy */
}
2) For a global defined object, the constructor is not called at runtime.
Creating an object must happen in a function.
What is the reason for all this initialisation problems?
Thanks.
More information about the Gcc-help
mailing list