#include int rt·boot( int (*main)(int,char **,char **), int argc, char **argv, int (*init)(int, char **, char **), void (*fini)(void), void (*exit)(void) ) { char **envp = argv+argc+1; rt·environ = envp; if(exit) rt·context.exit = exit; if(fini) rt·context.fini = fini; if(init){ rt·context.init = init; init(argc, argv, envp); } /* XXX: * we could call __libc_start_main of musl here: * this would give us the normal C runtime along with ours * which would allow seamless linking to other libraries * or we can implement a compatibility layer */ rt·exit(main(argc, argv, envp)); /* should never get here */ return 0; }