libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / glue / start_dyn.c
blobe2f141a160f9ed26d76d8feff1c0d15d338ab0ea
1 /*
2 * Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
6 * Distributed under the terms of the NewOS License.
7 */
10 #include <user_runtime.h>
12 #include <string.h>
13 #include <stdlib.h>
16 extern int main(int argc, char **argv, char **env);
17 extern void _init_c_library_(int argc, char **argv, char **env);
18 extern void _call_init_routines_(void);
20 int _start(int argc, char **argv, char **env);
22 // these are part of libroot.so, and initialized here
23 extern char **argv_save;
24 extern thread_id __main_thread_id;
25 extern char **environ;
27 bool __gHaikuStartupCode = true;
30 int
31 _start(int argc, char **argv, char **environment)
33 int returnCode;
35 argv_save = argv;
36 __main_thread_id = find_thread(NULL);
38 // These two are called to make our glue code usable under BeOS R5
39 // - in Haiku, they are both empty.
40 _init_c_library_(argc, argv, environment);
41 _call_init_routines_();
43 returnCode = main(argc, argv, environment);
45 exit(returnCode);
46 return 0;