summaryrefslogtreecommitdiff
path: root/components/cplusplus/crt_init.c
blob: 20f81cdb54877bc9da625961506d2283a6db5cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <rtthread.h>

int cplusplus_system_init(void)
{
#if defined(__GNUC__) && !defined(__CC_ARM)
    extern unsigned char __ctors_start__;
    extern unsigned char __ctors_end__;
    typedef void (*func)(void);

    /* .ctors initalization */
    func *ctors_func;

    for (ctors_func = (func *)&__ctors_start__;
         ctors_func < (func *)&__ctors_end__;
         ctors_func ++)
    {
        (*ctors_func)();
    }
#endif

    return 0;
}
INIT_COMPONENT_EXPORT(cplusplus_system_init);