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