rjb 1.3.0-universal-darwin-10

Sign up to get free protection for your applications and to get access to all the features.
data/ext/RBridge.java ADDED
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Rjb - Ruby <-> Java Bridge
3
+ * Copyright(c) 2004 arton
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * $Id: RBridge.java 2 2006-04-11 19:04:40Z arton $
16
+ * $Log: RBridge.java,v $
17
+ * Revision 1.2 2004/06/19 09:05:00 arton
18
+ * delete debug lines
19
+ *
20
+ * Revision 1.1 2004/06/19 09:00:19 arton
21
+ * Initial revision
22
+ *
23
+ */
24
+ package jp.co.infoseek.hp.arton.rjb;
25
+ import java.lang.reflect.InvocationHandler;
26
+ import java.lang.reflect.Method;
27
+ import java.lang.reflect.Proxy;
28
+
29
+ public class RBridge implements InvocationHandler {
30
+ public Object register(Class itf) {
31
+ return Proxy.newProxyInstance(itf.getClassLoader(),
32
+ new Class[] { itf }, this);
33
+ }
34
+ public Object invoke(Object proxy, Method method, Object[] args)
35
+ throws Throwable {
36
+ return call(method.getName(), proxy, args);
37
+ }
38
+ private native Object call(String methodName, Object target, Object[] args);
39
+ }
data/ext/depend ADDED
@@ -0,0 +1,23 @@
1
+ riconv.o : riconv.c jp_co_infoseek_hp_arton_rjb_RBridge.h
2
+ rjb.o : rjb.c jp_co_infoseek_hp_arton_rjb_RBridge.h riconv.h rjb.h
3
+ rjbexception.o : rjbexception.c jp_co_infoseek_hp_arton_rjb_RBridge.h riconv.h rjb.h
4
+ load.o : load.c jp_co_infoseek_hp_arton_rjb_RBridge.h
5
+ jp_co_infoseek_hp_arton_rjb_RBridge.h : jniwrap.h ../data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
6
+ javah -classpath ../data/rjb jp.co.infoseek.hp.arton.rjb.RBridge
7
+ ../data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class : RBridge.java
8
+ mkdir -p ../data/rjb/jp/co/infoseek/hp/arton/rjb
9
+ javac -d ../data/rjb RBridge.java
10
+ test : rjbcore.so ../test/jp/co/infoseek/hp/arton/rjb/Test.class ../test/jp/co/infoseek/hp/arton/rjb/IBase.class ../test/jp/co/infoseek/hp/arton/rjb/Base.class ../test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
11
+ ruby ../test/test.rb
12
+ ../test/jp/co/infoseek/hp/arton/rjb/Test.class : ../test/Test.java
13
+ javac ../test/Test.java
14
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/Test.class", "../test/jp/co/infoseek/hp/arton/rjb")'
15
+ ../test/jp/co/infoseek/hp/arton/rjb/IBase.class : ../test/IBase.java
16
+ javac ../test/IBase.java
17
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/IBase.class", "../test/jp/co/infoseek/hp/arton/rjb")'
18
+ ../test/jp/co/infoseek/hp/arton/rjb/Base.class : ../test/Base.java ../test/jp/co/infoseek/hp/arton/rjb/IBase.class
19
+ javac -classpath ../test ../test/Base.java
20
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/Base.class", "../test/jp/co/infoseek/hp/arton/rjb")'
21
+ ../test/jp/co/infoseek/hp/arton/rjb/ExtBase.class : ../test/ExtBase.java
22
+ javac -classpath ../test ../test/ExtBase.java
23
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/ExtBase.class", "../test/jp/co/infoseek/hp/arton/rjb")'
data/ext/extconf.h ADDED
@@ -0,0 +1,9 @@
1
+ #ifndef EXTCONF_H
2
+ #define EXTCONF_H
3
+ #define HAVE_JNI_H 1
4
+ #define HAVE_DL_H 1
5
+ #define HAVE_NL_LANGINFO 1
6
+ #define HAVE_SETLOCALE 1
7
+ #define HAVE_GETENV 1
8
+ #define RJB_RUBY_VERSION_CODE 187
9
+ #endif
data/ext/jniwrap.h ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Rjb - Ruby <-> Java Bridge
3
+ * Copyright(c) 2006 Kuwashima
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * $Id: jniwrap.h 4 2006-09-11 15:21:38Z arton $
16
+ */
17
+ #ifndef _Included_jniwrap
18
+ #define _Included_jniwrap
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ #if defined(__GNUC__) && (defined(__CYGWIN32__) || defined(__MINGW32__))
24
+ typedef long long __int64;
25
+ #endif
26
+
27
+ #include <jni.h>
28
+
29
+ #ifdef __cplusplus
30
+ }
31
+ #endif
32
+ #endif
@@ -0,0 +1,21 @@
1
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2
+ #include <jni.h>
3
+ /* Header for class jp_co_infoseek_hp_arton_rjb_RBridge */
4
+
5
+ #ifndef _Included_jp_co_infoseek_hp_arton_rjb_RBridge
6
+ #define _Included_jp_co_infoseek_hp_arton_rjb_RBridge
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+ /*
11
+ * Class: jp_co_infoseek_hp_arton_rjb_RBridge
12
+ * Method: call
13
+ * Signature: (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
14
+ */
15
+ JNIEXPORT jobject JNICALL Java_jp_co_infoseek_hp_arton_rjb_RBridge_call
16
+ (JNIEnv *, jobject, jstring, jobject, jobjectArray);
17
+
18
+ #ifdef __cplusplus
19
+ }
20
+ #endif
21
+ #endif
data/ext/load.c ADDED
@@ -0,0 +1,380 @@
1
+ /*
2
+ * Rjb - Ruby <-> Java Bridge
3
+ * Copyright(c) 2004,2005,2006,2009,2010 arton
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * $Id: load.c 148 2010-10-23 08:38:44Z arton $
16
+ */
17
+
18
+ #include <stdlib.h>
19
+ #include <stdio.h>
20
+ #include "ruby.h"
21
+ #include "extconf.h"
22
+ #if RJB_RUBY_VERSION_CODE < 190
23
+ #include "intern.h"
24
+ #include "st.h"
25
+ #include "util.h"
26
+ #else
27
+ #include "ruby/intern.h"
28
+ #include "ruby/st.h"
29
+ #include "ruby/util.h"
30
+ #endif
31
+ #include "jniwrap.h"
32
+ #include "jp_co_infoseek_hp_arton_rjb_RBridge.h"
33
+ #include "rjb.h"
34
+
35
+ #define JVM_TYPE "client"
36
+ #define ALT_JVM_TYPE "classic"
37
+
38
+ #if defined(_WIN32) || defined(__CYGWIN__)
39
+ #if defined(__CYGWIN__)
40
+ #define JVMDLL "%s/jre/bin/%s/jvm.dll"
41
+ #define DIRSEPARATOR '/'
42
+ #else
43
+ #define JVMDLL "%s\\jre\\bin\\%s\\jvm.dll"
44
+ #define DIRSEPARATOR '\\'
45
+ #endif
46
+ #define CLASSPATH_SEP ';'
47
+ #elif defined(__APPLE__) && defined(__MACH__)
48
+ static char* JVMDLL = "%s/JavaVM";
49
+ #define DIRSEPARATOR '/'
50
+ #define CLASSPATH_SEP ':'
51
+ #define HOME_NAME "/Home"
52
+ #define HOME_NAME_LEN strlen(HOME_NAME)
53
+ #define DEFAULT_HOME "/System/Library/Frameworks/JavaVM.framework"
54
+ #elif defined(_AIX)
55
+ #define ARCH "ppc"
56
+ #undef JVM_TYPE
57
+ #define JVM_TYPE "j9vm"
58
+ #elif defined(__hpux)
59
+ #define JVMDLL "%s/jre/lib/%s/%s/libjvm.sl"
60
+ #define ARCH "PA_RISC"
61
+ #undef JVM_TYPE
62
+ #define JVM_TYPE "server"
63
+ #define DIRSEPARATOR '/'
64
+ #define CLASSPATH_SEP ':'
65
+ #else /* defined(_WIN32) || defined(__CYGWIN__) */
66
+ #if defined(__sparc_v9__)
67
+ #define ARCH "sparcv9"
68
+ #elif defined(__sparc__)
69
+ #define ARCH "sparc"
70
+ #elif defined(__amd64__)
71
+ #define ARCH "amd64"
72
+ #undef JVM_TYPE
73
+ #define JVM_TYPE "server"
74
+ #elif defined(i586) || defined(__i386__)
75
+ #define ARCH "i386"
76
+ #endif
77
+ #ifndef ARCH
78
+ #include <sys/systeminfo.h>
79
+ #endif
80
+ #define JVMDLL "%s/jre/lib/%s/%s/libjvm.so"
81
+ #define DIRSEPARATOR '/'
82
+ #define CLASSPATH_SEP ':'
83
+ #endif
84
+
85
+ #if defined(__APPLE__) && defined(__MACH__)
86
+ static char* CREATEJVM = "JNI_CreateJavaVM";
87
+ static char* GETDEFAULTJVMINITARGS = "JNI_GetDefaultJavaVMInitArgs";
88
+ #else
89
+ #define CREATEJVM "JNI_CreateJavaVM"
90
+ #define GETDEFAULTJVMINITARGS "JNI_GetDefaultJavaVMInitArgs"
91
+ #endif
92
+
93
+ typedef int (JNICALL *GETDEFAULTJAVAVMINITARGS)(void*);
94
+ typedef int (JNICALL *CREATEJAVAVM)(JavaVM**, JNIEnv**, void*);
95
+
96
+
97
+ static VALUE jvmdll = Qnil;
98
+ static VALUE getdefaultjavavminitargsfunc;
99
+ static VALUE createjavavmfunc;
100
+
101
+ static int open_jvm(char* libpath)
102
+ {
103
+ int sstat;
104
+ VALUE* argv;
105
+
106
+ rb_require("dl");
107
+ #if !defined(RUBINIUS)
108
+ if (!rb_const_defined_at(rb_cObject, rb_intern("DL")))
109
+ {
110
+ rb_raise(rb_eRuntimeError, "Constants DL is not defined.");
111
+ return 0;
112
+ }
113
+ #endif
114
+ argv = ALLOCA_N(VALUE, 4);
115
+ *argv = rb_const_get(rb_cObject, rb_intern("DL"));
116
+ *(argv + 1) = rb_intern("dlopen");
117
+ *(argv + 2) = 1;
118
+ *(argv + 3) = rb_str_new2(libpath);
119
+ jvmdll = rb_protect(rjb_safe_funcall, (VALUE)argv, &sstat);
120
+ if (sstat)
121
+ {
122
+ return 0;
123
+ }
124
+ /* get function pointers of JNI */
125
+ #if RJB_RUBY_VERSION_CODE < 190
126
+ getdefaultjavavminitargsfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2(GETDEFAULTJVMINITARGS), rb_str_new2("IP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0);
127
+ createjavavmfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2(CREATEJVM), rb_str_new2("IPPP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0);
128
+ #else
129
+ getdefaultjavavminitargsfunc = rb_funcall(jvmdll, rb_intern("[]"), 1, rb_str_new2(GETDEFAULTJVMINITARGS));
130
+ createjavavmfunc = rb_funcall(jvmdll, rb_intern("[]"), 1, rb_str_new2(CREATEJVM));
131
+ #endif
132
+ return 1;
133
+ }
134
+ /*
135
+ * not completed, only valid under some circumstances.
136
+ */
137
+ static int load_jvm(char* jvmtype)
138
+ {
139
+ char* libpath;
140
+ char* java_home;
141
+ char* jh;
142
+
143
+ jh = getenv("JAVA_HOME");
144
+ #if defined(__APPLE__) && defined(__MACH__)
145
+ if (!jh)
146
+ {
147
+ jh = DEFAULT_HOME;
148
+ }
149
+ else
150
+ {
151
+ if (strlen(jh) > HOME_NAME_LEN)
152
+ {
153
+ int len = strlen(jh);
154
+ char* p = ALLOCA_N(char, len + 8);
155
+ jh = strcpy(p, jh);
156
+ if (*(jh + len - 1) == '/')
157
+ {
158
+ --len;
159
+ *(jh + len) = '\0';
160
+ }
161
+ if (strcasecmp(jh + len - HOME_NAME_LEN, HOME_NAME) == 0)
162
+ {
163
+ strcpy(p + len, "/..");
164
+ }
165
+ }
166
+ }
167
+ #endif
168
+ if (!jh)
169
+ {
170
+ if (RTEST(ruby_verbose))
171
+ {
172
+ fprintf(stderr, "no JAVA_HOME environment\n");
173
+ }
174
+ return 0;
175
+ }
176
+ #if defined(_WIN32)
177
+ if (*jh == '"' && *(jh + strlen(jh) - 1) == '"')
178
+ {
179
+ char* p = ALLOCA_N(char, strlen(jh) + 1);
180
+ strcpy(p, jh + 1);
181
+ *(p + strlen(p) - 1) = '\0';
182
+ jh = p;
183
+ }
184
+ #endif
185
+ java_home = ALLOCA_N(char, strlen(jh) + 1);
186
+ strcpy(java_home, jh);
187
+ if (*(java_home + strlen(jh) - 1) == DIRSEPARATOR)
188
+ {
189
+ *(java_home + strlen(jh) - 1) = '\0';
190
+ }
191
+ #if defined(_WIN32) || defined(__CYGWIN__)
192
+ libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home)
193
+ + strlen(jvmtype) + 1);
194
+ sprintf(libpath, JVMDLL, java_home, jvmtype);
195
+ #elif defined(__APPLE__) && defined(__MACH__)
196
+ libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home) + 1);
197
+ sprintf(libpath, JVMDLL, java_home);
198
+ #else /* not Windows / MAC OS-X */
199
+ libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home)
200
+ + strlen(ARCH) + strlen(jvmtype) + 1);
201
+ sprintf(libpath, JVMDLL, java_home, ARCH, jvmtype);
202
+ #endif
203
+ return open_jvm(libpath);
204
+ }
205
+
206
+ static int load_bridge(JNIEnv* jenv)
207
+ {
208
+ JNINativeMethod nmethod[1];
209
+ jbyte buff[8192];
210
+ char* bridge;
211
+ int len;
212
+ FILE* f;
213
+ #if defined(RUBINIUS)
214
+ VALUE v = rb_const_get(rb_cObject, rb_intern("RjbConf"));
215
+ v = rb_const_get(v, rb_intern("BRIDGE_FILE"));
216
+ #else
217
+ VALUE v = rb_const_get_at(rb_const_get(rb_cObject, rb_intern("RjbConf")),
218
+ rb_intern("BRIDGE_FILE"));
219
+ #endif
220
+ bridge = StringValuePtr(v);
221
+ #if defined(DOSISH)
222
+ bridge = ALLOCA_N(char, strlen(bridge) + 8);
223
+ strcpy(bridge, StringValuePtr(v));
224
+ for (len = 0; bridge[len]; len++)
225
+ {
226
+ if (bridge[len] == '/')
227
+ {
228
+ bridge[len] = '\\';
229
+ }
230
+ }
231
+ #endif
232
+ f = fopen(bridge, "rb");
233
+ if (f == NULL)
234
+ {
235
+ return -1;
236
+ }
237
+ len = fread(buff, 1, sizeof(buff), f);
238
+ fclose(f);
239
+ rjb_rbridge = (*jenv)->DefineClass(jenv,
240
+ "jp/co/infoseek/hp/arton/rjb/RBridge", get_systemloader(jenv), buff, len);
241
+ if (rjb_rbridge == NULL)
242
+ {
243
+ rjb_check_exception(jenv, 1);
244
+ }
245
+ rjb_register_bridge = (*jenv)->GetMethodID(jenv, rjb_rbridge, "register",
246
+ "(Ljava/lang/Class;)Ljava/lang/Object;");
247
+ nmethod[0].name = "call";
248
+ nmethod[0].signature = "(Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;";
249
+ nmethod[0].fnPtr = Java_jp_co_infoseek_hp_arton_rjb_RBridge_call;
250
+ (*jenv)->RegisterNatives(jenv, rjb_rbridge, nmethod, 1);
251
+ rjb_rbridge = (*jenv)->NewGlobalRef(jenv, rjb_rbridge);
252
+ return 0;
253
+ }
254
+
255
+ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALUE argv)
256
+ {
257
+ static JavaVMOption soptions[] = {
258
+ #if defined(__sparc_v9__) || defined(__sparc__)
259
+ { "-Xusealtsigs", NULL },
260
+ #elif defined(linux) || defined(__linux__)
261
+ { "-Xrs", NULL },
262
+ #elif defined(__APPLE__) && defined(_ARCH_PPC)
263
+ { "-Xrs", NULL },
264
+ #endif
265
+ #if defined(SHOW_JAVAGC)
266
+ { "-verbose:gc", NULL },
267
+ #endif
268
+ { "DUMMY", NULL }, /* for classpath count */
269
+ };
270
+ char* newpath;
271
+ int len;
272
+ int result;
273
+ GETDEFAULTJAVAVMINITARGS initargs;
274
+ CREATEJAVAVM createjavavm;
275
+ JavaVMOption* options;
276
+ int optlen;
277
+ int i;
278
+ VALUE optval;
279
+
280
+ if (!RTEST(jvmdll))
281
+ {
282
+ char* libjvm = getenv("JVM_LIB");
283
+ #if defined(_WIN32)
284
+ if (libjvm && *libjvm == '"' && *(libjvm + strlen(libjvm) - 1) == '"')
285
+ {
286
+ char* p = ALLOCA_N(char, strlen(libjvm) + 1);
287
+ strcpy(p, libjvm + 1);
288
+ *(p + strlen(p) - 1) = '\0';
289
+ libjvm = p;
290
+ }
291
+ #endif
292
+ if (libjvm == NULL || !open_jvm(libjvm))
293
+ {
294
+ #if defined(__APPLE__) && defined(__MACH__)
295
+ if (!(load_jvm(JVM_TYPE) || load_jvm(ALT_JVM_TYPE)))
296
+ {
297
+ JVMDLL = "%s/Libraries/libjvm.dylib";
298
+ CREATEJVM = "JNI_CreateJavaVM_Impl";
299
+ GETDEFAULTJVMINITARGS = "JNI_GetDefaultJavaVMInitArgs_Impl";
300
+ #endif
301
+ if (!(load_jvm(JVM_TYPE) || load_jvm(ALT_JVM_TYPE)))
302
+ {
303
+ return -1;
304
+ }
305
+ #if defined(__APPLE__) && defined(__MACH__)
306
+ }
307
+ #endif
308
+ }
309
+
310
+ #if RJB_RUBY_VERSION_CODE < 190 && !defined(RUBINIUS)
311
+ ruby_errinfo = Qnil;
312
+ #else
313
+ rb_set_errinfo(Qnil);
314
+ #endif
315
+ }
316
+
317
+ if (NIL_P(getdefaultjavavminitargsfunc))
318
+ {
319
+ return -1;
320
+ }
321
+ initargs = (GETDEFAULTJAVAVMINITARGS)NUM2ULONG(getdefaultjavavminitargsfunc);
322
+ result = initargs(vm_args);
323
+ if (0 > result)
324
+ {
325
+ return result;
326
+ }
327
+ len = strlen(userpath);
328
+ if (getenv("CLASSPATH"))
329
+ {
330
+ len += strlen(getenv("CLASSPATH"));
331
+ }
332
+ newpath = ALLOCA_N(char, len + 32);
333
+ if (getenv("CLASSPATH"))
334
+ {
335
+ sprintf(newpath, "-Djava.class.path=%s%c%s",
336
+ userpath, CLASSPATH_SEP, getenv("CLASSPATH"));
337
+ }
338
+ else
339
+ {
340
+ sprintf(newpath, "-Djava.class.path=%s", userpath);
341
+ }
342
+ optlen = 0;
343
+ if (!NIL_P(argv))
344
+ {
345
+ optlen += RARRAY_LEN(argv);
346
+ }
347
+ optlen += COUNTOF(soptions);
348
+ options = ALLOCA_N(JavaVMOption, optlen);
349
+ options->optionString = newpath;
350
+ options->extraInfo = NULL;
351
+ for (i = 1; i < COUNTOF(soptions); i++)
352
+ {
353
+ *(options + i) = soptions[i - 1];
354
+ }
355
+ for (; i < optlen; i++)
356
+ {
357
+ optval = rb_ary_entry(argv, i - COUNTOF(soptions));
358
+ Check_Type(optval, T_STRING);
359
+ (options + i)->optionString = StringValueCStr(optval);
360
+ (options + i)->extraInfo = NULL;
361
+ }
362
+ vm_args->nOptions = optlen;
363
+ vm_args->options = options;
364
+ vm_args->ignoreUnrecognized = JNI_TRUE;
365
+ if (NIL_P(createjavavmfunc))
366
+ {
367
+ return -1;
368
+ }
369
+ createjavavm = (CREATEJAVAVM)NUM2ULONG(createjavavmfunc);
370
+ result = createjavavm(&rjb_jvm, pjenv, vm_args);
371
+ if (!result)
372
+ {
373
+ result = load_bridge(*pjenv);
374
+ if (RTEST(ruby_verbose) && result < 0)
375
+ {
376
+ fprintf(stderr, "failed to load the bridge class\n");
377
+ }
378
+ }
379
+ return result;
380
+ }