#include #include extern int main(int argc, char **argv); extern size_t start_ctors, end_ctors, start_dtors, end_dtors; void __tce_libc_start(char **args) { // setup stdio term.fd = 0; __tce_libc_fsetup(&term); // call C++ static constructors size_t *call; for (call = &start_ctors; call < &end_ctors; call++) { ((void(*)(void))*call)(); } // call main char **lastarg = args; while (*lastarg) lastarg++; int ret = main((lastarg - args), args); // call C++ static destructors for (call = &start_dtors; call < &end_dtors; call++) { ((void(*)(void))*call)(); } process_exit(ret); }