GCC 3.2.2 (OAR build) question

leonp at plris.com leonp at plris.com
Tue Feb 28 09:20:00 UTC 2006

Hello, all.

Please, forgive me for 99% off-topic question, but as I use not "native" 

I have the following very strange gcc problem - in the file a.cpp there is 
some cCL class declaration and also global object CL is created. The 
constructor of the class inserts 'this' pointer into a global array pCLs. 
This array is declared system wide and all usage of the object therefore is 
done using this pointer and the object is never referenced directly.

Now, when everything is linked in - the 'a' object module is never used!
I checked the a.o content - there is an object CL (record of type 000B) and 
everything looks OK, but the executable has no a.o at all in its map file 
(and nothing works obviously).

Just for experiment, I added the following into a.cpp: 'volatile int 
x;' (global var declaration) and 'extern volatile int x' into main.cpp.
Magic! Now everything is OK - CL constructor was added into CTORS, all 
functions appeared in the map file.

Can someone help me to understand where the first variant is incorrect?
Many many thanks ahead.

More information about the users mailing list