Got the separation between start_dyn.o and libroot.so wrong:

__libc_argc and __libc_argv are initialized in libroot's startup code.
That fix now makes BApplication::ArgvReceived() work as it should.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11198 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-02-02 04:36:16 +00:00
parent 96b5ca7902
commit 9465cd7465
2 changed files with 19 additions and 20 deletions

View File

@ -1,13 +1,13 @@
/*
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
/*
* Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
#include <user_runtime.h>
#include <syscalls.h>
#include <string.h>
#include <stdlib.h>
@ -15,14 +15,11 @@
extern int main(int argc, char **argv);
int _start(int argc, char **argv, char **, struct uspace_program_args *);
int _start(int argc, char **argv, char **env, struct uspace_program_args *args);
// these are part of libroot.so, and initialized here
extern int __libc_argc;
extern char **__libc_argv;
extern char **argv_save;
extern thread_id __main_thread_id;
extern char **environ;
@ -33,16 +30,15 @@ extern char **environ;
int
_start(int argc, char **argv, char **_environ, struct uspace_program_args *args)
{
int retcode;
int returnCode;
__libc_argc = args->argc;
__libc_argv = argv_save = args->argv;
argv_save = args->argv;
__main_thread_id = find_thread(NULL);
environ = args->envp;
retcode = main(__libc_argc, __libc_argv);
returnCode = main(__libc_argc, __libc_argv);
exit(retcode);
exit(returnCode);
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
@ -14,12 +14,12 @@
void initialize_before(image_id imageID, struct uspace_program_args const *args);
char *__progname = NULL;
int __libc_argc;
char **__libc_argv;
char _single_threaded = true;
// determines if I/O locking needed; needed for BeOS compatibility
int __libc_argc;
char **__libc_argv;
thread_id __main_thread_id;
char **argv_save;
// needed for BeOS compatibility - they are set in the startup code
@ -37,6 +37,9 @@ initialize_before(image_id imageID, struct uspace_program_args const *args)
__progname++;
}
__libc_argc = args->argc;
__libc_argv = args->argv;
__init_time();
__init_image(args);
__init_dlfcn(args);