[gccsdk] GCCSDK GCC 4 status update

gccsdk at jip22.freeuk.com gccsdk at jip22.freeuk.com
Sat Jun 2 05:34:28 PDT 2007


John Tytgat wrote:

> In message <88ef9aec4e.james at iyonix.jip22.freeuk.com>
>           gccsdk at jip22.freeuk.com wrote:
> 
>> I may be way off the mark here as I've not used C++ much on RISC OS,
>> but how does (non-trivial) static initialisation of namespace scope
>> variables interact with module initialisation and entering the module?
>> 
>> IIRC. for a given execution unit, it must only happen *before*
>> any functions in that execution unit are entered. This leaves scope
>> for allocations at initialisation time (presumably using the RMA) and
>> when running a module application, presumably using the heap in
>> application space. [I'm not sure about this point].
>> 
>> I could see this getting quite hairy with say a statically initialised
>> std::vector, which is then resized by the running application, or
>> destructors of statically allocated objects are called and application
>> exit or module finalisation.
> 
> Such static initialisation code gets run via __gccmain uses __CTOR_LIST__
> array to call all the initialisation routines.  __gccmain is one of the
> first calls in any gcc compiled main() routine.  So that meams those
> are run in the module start code (and not module init) routine.  BTW, that
> was one of the things I had to fix to get C++ module support working in
> 3.4.5, see <URL:http://www.riscos.info/websvn/listing.php?repname=gccs
> dk&path=%2Ftrunk%2Fgcc%2F&rev=1746&sc=1>.

So does this mean you can't in general use such objects in the module 
initialisation, finalisation, SWI handlers and so on as they won't be 
initialised.

James




More information about the gcc mailing list