xref: /haiku/src/system/glue/start_dyn.c (revision cbe35e2031cb2bfb757422f35006bb9bd382bed1)
1 /*
2  * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2001, Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 
9 
10 #include <user_runtime.h>
11 
12 #include <string.h>
13 #include <stdlib.h>
14 
15 
16 extern int main(int argc, char **argv, char **env);
17 
18 int _start(int argc, char **argv, char **env, struct uspace_program_args *args);
19 
20 // these are part of libroot.so, and initialized here
21 extern char **argv_save;
22 extern thread_id __main_thread_id;
23 extern char **environ;
24 
25 
26 /* The argument list is redundant, but that is for keeping BeOS compatibility.
27  * BeOS doesn't have the last pointer, though.
28  */
29 
30 int
31 _start(int argc, char **argv, char **_environ, struct uspace_program_args *args)
32 {
33 	int returnCode;
34 
35 	argv_save = args->argv;
36 	__main_thread_id = find_thread(NULL);
37 
38 	returnCode = main(args->argc, args->argv, args->envp);
39 
40 	exit(returnCode);
41 	return 0;
42 }
43 
44