ext/load.c in rjb-1.1.2 vs ext/load.c in rjb-1.1.3

- old
+ new

@@ -10,11 +10,11 @@ * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * $Id: load.c 43 2007-12-26 18:55:04Z kuwa1 $ + * $Id: load.c 65 2008-03-26 13:19:29Z arton $ */ #include <stdlib.h> #include <stdio.h> #include "ruby.h" @@ -91,10 +91,14 @@ #else jh = getenv("JAVA_HOME"); #endif if (!jh) { + if (RTEST(ruby_verbose)) + { + fprintf(stderr, "no JAVA_HOME environment\n"); + } return 0; } #if defined(_WIN32) if (*jh == '"' && *(jh + strlen(jh) - 1) == '"') { @@ -130,10 +134,11 @@ return 0; } jvmdll = rb_funcall(rb_const_get(rb_cObject, rb_intern("DL")), rb_intern("dlopen"), 1, rb_str_new2(libpath)); + //get function pointers of JNI #if RJB_RUBY_VERSION_CODE < 190 getdefaultjavavminitargsfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2("JNI_GetDefaultJavaVMInitArgs"), rb_str_new2("IP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0); createjavavmfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2("JNI_CreateJavaVM"), rb_str_new2("IPPP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0); #else getdefaultjavavminitargsfunc = rb_funcall(jvmdll, rb_intern("[]"), 1, rb_str_new2("JNI_GetDefaultJavaVMInitArgs")); @@ -279,9 +284,13 @@ createjavavm = (CREATEJAVAVM)NUM2ULONG(createjavavmfunc); result = createjavavm(&rjb_jvm, pjenv, vm_args); if (!result) { result = load_bridge(*pjenv); + if (RTEST(ruby_verbose) && result < 0) + { + fprintf(stderr, "failed to load the bridge class\n"); + } } return result; }