kernel/eka/compsupp/rvct2_1/ucppinit.cpp
changeset 266 0008ccd16016
parent 259 57b9594f5772
child 272 70a6efdb753f
child 281 13fbfa31d2ba
equal deleted inserted replaced
259:57b9594f5772 266:0008ccd16016
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "ARM EABI LICENCE.txt"
       
     5 // which accompanies this distribution, and is available
       
     6 // in kernel/eka/compsupp.
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // toplevel initialization/destruction routines for 'user side' code compiled 
       
    15 // with the ARMEDG compiler. intended for static linking
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "cppinit.h"
       
    20 
       
    21 NUKE_SYMBOL(__call_ctors(void));
       
    22 NUKE_SYMBOL(__call_dtors(void));
       
    23 
       
    24 extern "C" {
       
    25 // linker symbols 
       
    26 __weak PFV C$$pi_ctorvec$$Base;
       
    27 __weak PFV C$$pi_ctorvec$$Limit;
       
    28 __weak void _fp_init(void);
       
    29 
       
    30 
       
    31 // This calls each of the compiler constructed functions referenced from pi_ctorvec.
       
    32 // These functions arrange to 'call' the appropriate constructor for the 'static' instance
       
    33 // (in fact the call may be inlined). If the class of the instance has a destructor then 
       
    34 // compiler records that this object needs 'destructing' at 'exit' time. It does this by 
       
    35 // calling the function __cxa_atexit. We provide our own definition of this.
       
    36 // 
       
    37 void __cpp_initialise(void)
       
    38     {
       
    39     void (*fp_init_fn)(void) = _fp_init;
       
    40     if (fp_init_fn) fp_init_fn();
       
    41     PFV * ctor_vec = &C$$pi_ctorvec$$Base;
       
    42     PFV * ctor_limit = &C$$pi_ctorvec$$Limit;
       
    43     for(; ctor_vec < ctor_limit; ctor_vec++) (RELOCATE(ctor_vec, PFV))();
       
    44     }
       
    45 }	  
       
    46 
       
    47 
       
    48 
       
    49 
       
    50