2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Copyright 2002, Manuel J. Petit. All rights reserved.
4 ** Distributed under the terms of the NewOS License.
7 #include <newos/user_runtime.h>
8 #include <sys/syscalls.h>
10 extern void sys_exit(int retcode
);
12 extern void (*__ctor_list
)(void);
13 extern void (*__ctor_end
)(void);
15 int _start(unsigned image_id
, struct uspace_prog_args_t
*);
16 static void _call_ctors(void);
19 _start(unsigned imid
, struct uspace_prog_args_t
*uspa
)
24 ibc
= uspa
->rld_export
->dl_sym(imid
, "INIT_BEFORE_CTORS", 0);
25 iac
= uspa
->rld_export
->dl_sym(imid
, "INIT_AFTER_CTORS", 0);
28 ((libinit_f
*)(ibc
))(imid
, uspa
);
32 ((libinit_f
*)(iac
))(imid
, uspa
);
39 void _call_ctors(void)
43 for(f
= &__ctor_list
; f
< &__ctor_end
; f
++) {