crt_init.c 496 B

123456789101112131415161718192021222324
  1. #include <rtthread.h>
  2. int cplusplus_system_init(void)
  3. {
  4. #if defined(__GNUC__) && !defined(__CC_ARM)
  5. extern unsigned char __ctors_start__;
  6. extern unsigned char __ctors_end__;
  7. typedef void (*func)(void);
  8. /* .ctors initalization */
  9. func *ctors_func;
  10. for (ctors_func = (func *)&__ctors_start__;
  11. ctors_func < (func *)&__ctors_end__;
  12. ctors_func ++)
  13. {
  14. (*ctors_func)();
  15. }
  16. #endif
  17. return 0;
  18. }
  19. INIT_COMPONENT_EXPORT(cplusplus_system_init);