Patch to fix broken Linux compilation in r41

2010-06-13
2013-04-29
  • Hi jace developer(s),

    SVN revision 41 breaks compilation on Linux. The following patch fixes compilation for me
    on Ubuntu 10.04 with gcc-4.4.3-4ubuntu5 on x86_64. Please review my suggestions, and
    apply if appropriate. Note: if BBCode breaks my patch formatting again, please get the
    patch from here: http://data.xuvtools.org/jace_r41.patch

    Index: release/include/jace/UnixVmLoader.h
    ===================================================================
    --- release/include/jace/UnixVmLoader.h (revision 41)
    +++ release/include/jace/UnixVmLoader.h (working copy)
    @@ -47,7 +47,7 @@
        *
         * @throws JNIException if an error occurs while loading the JVM library
        */
    -  JACE_API UnixVmLoader( std::string _path, jint jniVersion ) throws (JNIException);
    +  JACE_API UnixVmLoader( std::string _path, jint jniVersion ) throw (JNIException);
        JACE_API virtual ~UnixVmLoader();
    
       JACE_API jint createJavaVM(JavaVM **pvm, void **env, void *args) const;
    Index: source/c++/source/jace/UnixVmLoader.cpp
    ===================================================================
    --- source/c++/source/jace/UnixVmLoader.cpp (revision 41)
    +++ source/c++/source/jace/UnixVmLoader.cpp (working copy)
    @@ -13,8 +13,8 @@
    
     BEGIN_NAMESPACE( jace )
    
    -UnixVmLoader::UnixVmLoader( std::string path_, jint jniVer ) throws (JNIException) : 
    -  jniVersion( jniVer ), path( path_ ), lib( 0 )
    +UnixVmLoader::UnixVmLoader( std::string path_, jint jniVersion ) throw (JNIException) : 
    +  VmLoader(jniVersion), path( path_ ), lib( 0 )
     {
       lib = dlopen( path.c_str(), RTLD_NOW | RTLD_GLOBAL );
       if (!lib)
    @@ -41,11 +41,11 @@
       }
     }
    
    -jint UnixVmLoader::createJavaVM( JavaVM **pvm, void **env, void *args ) {
    +jint UnixVmLoader::createJavaVM( JavaVM **pvm, void **env, void *args ) const {
       return createJavaVMPtr( pvm, env, args );
     }
    
    -jint UnixVmLoader::getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ) {
    +jint UnixVmLoader::getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ) const {
       return getCreatedJavaVMsPtr( vmBuf, bufLen, nVMs );
     }
    
    Index: source/c++/source/jace/JNIHelper.cpp
    ===================================================================
    --- source/c++/source/jace/JNIHelper.cpp    (revision 41)
    +++ source/c++/source/jace/JNIHelper.cpp    (working copy)
    @@ -636,7 +636,7 @@
        deleteLocalRef(env, hookClass);
     }
    
    -JavaVM* getJavaVM()
    +JavaVM* getJavaVM() throw (::jace::JNIException)
     {
       return javaVM;
     }
    Index: source/c++/include/jace/UnixVmLoader.h
    ===================================================================
    --- source/c++/include/jace/UnixVmLoader.h  (revision 41)
    +++ source/c++/include/jace/UnixVmLoader.h  (working copy)
    @@ -47,7 +47,7 @@
        *
         * @throws JNIException if an error occurs while loading the JVM library
        */
    -  JACE_API UnixVmLoader( std::string _path, jint jniVersion ) throws (JNIException);
    +  JACE_API UnixVmLoader( std::string _path, jint jniVersion ) throw (JNIException);
        JACE_API virtual ~UnixVmLoader();
    
       JACE_API jint createJavaVM(JavaVM **pvm, void **env, void *args) const;
    

    All the best,

        Mario

     
  • Gili Tzabari
    Gili Tzabari
    2010-06-13

    Try r43.

    Thanks,
    Gili

     
  • Hi Gili!

    Hehe, you are fast! The r43 works perfect, except for a tiny, tiny issue. BTW, is it correct that getJavaVM() does not specify and exceptions to be thrown?

    Index: release/include/jace/JNIHelper.h
    ===================================================================
    --- release/include/jace/JNIHelper.h    (revision 43)
    +++ release/include/jace/JNIHelper.h    (working copy)
    @@ -95,7 +95,7 @@
     /**
      * Returns the current java virtual machine.
      */
    -JACE_API JavaVM* getJavaVM()
    +JACE_API JavaVM* getJavaVM();
    
     /**
    Index: source/c++/include/jace/JNIHelper.h
    ===================================================================
    --- source/c++/include/jace/JNIHelper.h (revision 43)
    +++ source/c++/include/jace/JNIHelper.h (working copy)
    @@ -95,7 +95,7 @@
     /**
      * Returns the current java virtual machine.
      */
    -JACE_API JavaVM* getJavaVM()
    +JACE_API JavaVM* getJavaVM();
    
     /**
    

    Cheers,

       Mario

     
  • Gili Tzabari
    Gili Tzabari
    2010-06-13

    Correct. getJavaVM() can no longer throw an exception with its new implementation. Try r44 ;)

    Thanks,
    Gili

     
  • Hi Gili,

    nice, r44 works like a charm on Linux! Thanks a lot!

    Mario