Patch for Preview: _Jv_ThisExecutable (The Saga Continues)

Andrew Haley aph@redhat.com
Thu Mar 27 17:24:00 GMT 2003


Mohan Embar writes:
 > Hi Patch People,
 > 
 > Here is a new cut at the _Jv_ThisExecutable() patch, based on this
 > post:
 > 
 > http://gcc.gnu.org/ml/java/2003-02/msg00517.html
 > 
 > Index: java/lang/natRuntime.cc
 > ===================================================================
 > RCS file: /cvsroot/gcc/gcc/libjava/java/lang/natRuntime.cc,v
 > retrieving revision 1.29.2.3
 > diff -u -2 -r1.29.2.3 natRuntime.cc
 > --- java/lang/natRuntime.cc	19 Feb 2003 16:18:03 -0000	1.29.2.3
 > +++ java/lang/natRuntime.cc	27 Feb 2003 15:11:54 -0000
 > @@ -129,4 +129,8 @@
 >  
 > 
 >  
 > +extern int _Jv_argc;
 > +extern const char **_Jv_argv;
 > +  // our process' command line arguments
 > +
 >  void
 >  java::lang::Runtime::exitInternal (jint status)
 > @@ -608,5 +612,5 @@
 >  
 >    // The name used to invoke this process (argv[0] in C).
 > -  SET ("gnu.gcj.progname", _Jv_ThisExecutable());
 > +  SET ("gnu.gcj.progname", _Jv_argv[0]);
 >  
 >    // Allow platform specific settings and overrides.

This breaks JvCreateJavaVM, because _Jv_argv isn't necessarily set.
Please check _Jv_argv != NULL before doing this.

BTW, is there any reason 

 > +extern int _Jv_argc;
 > +extern const char **_Jv_argv;

isn't in some header file?

Thanks,
Andrew.



More information about the Java-patches mailing list