rjb 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/ext/jniwrap.h +1 -1
- data/ext/load.c +13 -4
- data/ext/rjb.c +4 -4
- data/ext/rjb.h +2 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/ext/jniwrap.h
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: jniwrap.h
|
15
|
+
* $Id: jniwrap.h 82 2008-08-26 12:51:51Z arton $
|
16
16
|
*/
|
17
17
|
#ifndef _Included_jniwrap
|
18
18
|
#define _Included_jniwrap
|
data/ext/load.c
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: load.c
|
15
|
+
* $Id: load.c 82 2008-08-26 12:51:51Z arton $
|
16
16
|
*/
|
17
17
|
|
18
18
|
#include <stdlib.h>
|
@@ -90,6 +90,8 @@ static int load_jvm(char* jvmtype)
|
|
90
90
|
char* libpath;
|
91
91
|
char* java_home;
|
92
92
|
char* jh;
|
93
|
+
int sstat;
|
94
|
+
VALUE* argv;
|
93
95
|
|
94
96
|
jh = getenv("JAVA_HOME");
|
95
97
|
#if defined(__APPLE__) && defined(__MACH__)
|
@@ -150,9 +152,16 @@ static int load_jvm(char* jvmtype)
|
|
150
152
|
rb_raise(rb_eRuntimeError, "Constants DL is not defined.");
|
151
153
|
return 0;
|
152
154
|
}
|
153
|
-
|
154
|
-
|
155
|
-
|
155
|
+
argv = ALLOCA_N(VALUE, 4);
|
156
|
+
*argv = rb_const_get(rb_cObject, rb_intern("DL"));
|
157
|
+
*(argv + 1) = rb_intern("dlopen");
|
158
|
+
*(argv + 2) = 1;
|
159
|
+
*(argv + 3) = rb_str_new2(libpath);
|
160
|
+
jvmdll = rb_protect(rjb_safe_funcall, (VALUE)argv, &sstat);
|
161
|
+
if (sstat)
|
162
|
+
{
|
163
|
+
return 0;
|
164
|
+
}
|
156
165
|
/* get function pointers of JNI */
|
157
166
|
#if RJB_RUBY_VERSION_CODE < 190
|
158
167
|
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);
|
data/ext/rjb.c
CHANGED
@@ -12,10 +12,10 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: rjb.c
|
15
|
+
* $Id: rjb.c 82 2008-08-26 12:51:51Z arton $
|
16
16
|
*/
|
17
17
|
|
18
|
-
#define RJB_VERSION "1.1.
|
18
|
+
#define RJB_VERSION "1.1.6"
|
19
19
|
|
20
20
|
#include "ruby.h"
|
21
21
|
#include "extconf.h"
|
@@ -2779,7 +2779,7 @@ void Init_rjbcore()
|
|
2779
2779
|
rb_gc_register_address(&rjbb);
|
2780
2780
|
}
|
2781
2781
|
|
2782
|
-
|
2782
|
+
VALUE rjb_safe_funcall(VALUE args)
|
2783
2783
|
{
|
2784
2784
|
VALUE* argp = (VALUE*)args;
|
2785
2785
|
return rb_funcall2(*argp, *(argp + 1), *(argp + 2), argp + 3);
|
@@ -2829,7 +2829,7 @@ JNIEXPORT jobject JNICALL Java_jp_co_infoseek_hp_arton_rjb_RBridge_call
|
|
2829
2829
|
*argv = ptr->wrapped;
|
2830
2830
|
*(argv + 1) = id;
|
2831
2831
|
*(argv + 2) = argc - 3;
|
2832
|
-
result = rb_protect(
|
2832
|
+
result = rb_protect(rjb_safe_funcall, (VALUE)argv, &sstat);
|
2833
2833
|
rv2jobject(jenv, result, &j, NULL, 0);
|
2834
2834
|
/* I can't delete this object... */
|
2835
2835
|
break;
|
data/ext/rjb.h
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: rjb.h
|
15
|
+
* $Id: rjb.h 82 2008-08-26 12:51:51Z arton $
|
16
16
|
* $Log: rjb.h,v $
|
17
17
|
* Revision 1.1 2005/01/16 17:36:10 arton
|
18
18
|
* Initial revision
|
@@ -69,6 +69,7 @@ extern JNIEnv* rjb_attach_current_thread(void);
|
|
69
69
|
extern jclass rjb_find_class(JNIEnv* jenv, VALUE name);
|
70
70
|
extern void rjb_release_string(JNIEnv *jenv, jstring str, const char* chrs);
|
71
71
|
extern VALUE rjb_load_vm_default();
|
72
|
+
extern VALUE rjb_safe_funcall(VALUE args);
|
72
73
|
|
73
74
|
/* in rjbexception.c */
|
74
75
|
extern VALUE rjb_get_exception_class(JNIEnv* jenv, jstring str);
|
metadata
CHANGED