bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSProcessInfo's _gnu_process_args crash fix


From: Tom Koelman
Subject: Re: NSProcessInfo's _gnu_process_args crash fix
Date: Tue, 18 Feb 2003 16:30:41 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2

Adam Fedor <fedor@doc.com> writes:

> Tom Koelman wrote:
>> Hi,
>> Under MiNGQ _gnu_process_args crashes when argv is 0. This patch
>> fixes
>> this and sets the executable to the empty string when this happens.
>>
>
> Wow. How often does this happen? It seems pretty strange to me.

It happens under MinGW. When I create a dll that uses GNUstep, and
this dll in turn is called by a program that is not compiled by gcc
this is the case.

It is reproducable as follows:

untar this somewhere:

Attachment: arg0repro.tar.bz2
Description: Binary data

cd to arg0repro and "make"

In arg0repro/shared_obj/ix86/mingw32/gnu-gnu-gnu there now is
Test.dll, calltest.exe and calltest_msvc.exe. calltest.exe works okay
and prints "42", which it gets from the GNUstep using
Test.dll. calltest_msvc.exe is the same source, but compiled with
Microsoft's compiler, this one crashes in Foundation in
_gnu_process_args, because argv == 0.

> The documentation for the -arguments method is a little ambiguous. Is
> it supposed to include arg 0 or not?

I don't know. At several points in the Foundation code it is assumed
it exists though.

I unforunately do not know of a way to reliably get the arguments
under MinGW. GetCommandLine[1] followed by CommandLineToArgvW[2]
seemed to be a nice call, but some testing revealed that it returns
the complete command line as one string, despite the documentation
claiming something different.

Tom

[1] 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getcommandline.asp?frame=true&hidetoc=true
[2] 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/commandlinetoargvw.asp?frame=true&hidetoc=true

reply via email to

[Prev in Thread] Current Thread [Next in Thread]