classpath-patches
[Top][All Lists]
Advanced

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

Re: [cp-patches] [generics] RFC: fix generics branch compilation on Darw


From: Casey Marshall
Subject: Re: [cp-patches] [generics] RFC: fix generics branch compilation on Darwin
Date: Mon, 5 Dec 2005 21:47:15 -0800

On Dec 5, 2005, at 7:48 AM, Tom Tromey wrote:

"Casey" == Casey Marshall <address@hidden> writes:

Casey> java_lang_VMSystem.c references 'extern char **environ,' which isn't
Casey> defined on Darwin. java_lang_VMProcess.c has a little #if that
Casey> defines this to a special function (_NSGetEnviron) for Darwin; the
Casey> attached patch does the same for VMSystem.

If we need the same code in 2 places we ought to put it in a header.


Agreed.

Casey> Does this look OK? I haven't tested this yet (I'm not entirely sure Casey> how to do so; I've heard that jamvm can run this branch, so I'm going
Casey> to try that).

It is a bit more usual to check for 'environ' directly in configure
and then fall back to the other thing.  But, in this case this is not
of major importance.


(Archie had a similar reply, but I'm going to answer both (kinda) here)

Yeah, checking for 'environ' directly would be better; I did this because it was already done elsewhere in Classpath, so it was easy to get something running quickly.

Casey> +/* Some O/S's don't declare 'environ' */
Casey> +#if HAVE_CRT_EXTERNS_H
Casey> +/* Darwin does not have a variable named environ
Casey> +   but has a function which you can get the environ
Casey> +   variable with.  */
Casey> +#include <crt_externs.h>
Casey> +#define environ (*_NSGetEnviron())
Casey> +#endif /* HAVE_CRT_EXTERNS_H */
 [...]
Casey>  {
Casey> +#if !HAVE_CRT_EXTERNS_H
Casey>    extern char** environ;
Casey> +#endif /* HAVE_CRT_EXTERNS_H */

Just declare environ globally in the header file as well and update
java_lang_VMProcess.c.


OK.

Thanks.




reply via email to

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