On Wed, 18 May 2005 03:40:57 +0900, nobu.nokada wrote:


> Is this function called at each time when .so is loaded, and
> the area pointed by _NSGetArgv() shouldn't be changed?
> 
> I suspect that system dependent initialization of arguments
> should be integrated.

The _NSGetArgv function would appear to be an private function (inferring 
this from the leading underscore), so perhaps it'd be inappropriate to 
use it in the ruby core. Having said that, it is declared in <crt_externs.h>...

Perhaps an alternative would be to modify set_arg0() to change the
non-first argument to be empty C strings ("") rather than NULL?


More below:

> +#if defined(__APPLE__) && (defined(__MACH__) || defined(__DARWIN__)) && !defined(__MacOS_X__)

What is the purpose of the !defined(__MacOS_X__) ?

> +	int i, n = *argc, len = 0;
> +	char **v1 = *argv, **v2 = ALLOC_N(char*, n + 1);;
> +	for (i = 0; i < n; ++i) {
> +	    *v2[i] = strdup(*v1[i]);

I think the above line should be:
            
            v2[i] = strdup(v1[i]);

Thanks
Jonathan