2010-05-07 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / ikvm-native / jni.c
blobdec858e131f66a67e6ff2b0b445144a1d49ad070
1 /*
2 Copyright (C) 2004 Jeroen Frijters
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
20 Jeroen Frijters
21 jeroen@frijters.net
24 #include <stdarg.h>
25 #include "jni.h"
27 #ifdef _WIN32
28 #include <malloc.h>
29 #define ALLOCA _alloca
30 #else
31 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
32 #include <stdlib.h>
33 #else
34 #include <alloca.h>
35 #endif
36 #define ALLOCA alloca
37 #endif
39 static jobject JNICALL NewObject(JNIEnv* pEnv, jclass clazz, jmethodID methodID, ...)
41 jobject o;
42 va_list args;
43 va_start(args, methodID);
44 o = (*pEnv)->NewObjectV(pEnv, clazz, methodID, args);
45 va_end(args);
46 return o;
49 #define MAKE_ARG_ARRAY(pEnv, args, argarray) \
50 do { \
51 jbyte sig[257];\
52 int argc = (*pEnv)->GetMethodArgs(pEnv, methodID, sig);\
53 int i;\
54 argarray = (jvalue*)ALLOCA(argc * sizeof(jvalue));\
55 for(i = 0; i < argc; i++)\
57 switch(sig[i])\
59 case 'Z':\
60 case 'B':\
61 case 'S':\
62 case 'C':\
63 case 'I':\
64 argarray[i].i = va_arg(args, jint);\
65 break;\
66 case 'J':\
67 argarray[i].j = va_arg(args, jlong);\
68 break;\
69 case 'L':\
70 argarray[i].l = va_arg(args, jobject);\
71 break;\
72 case 'D':\
73 argarray[i].d = va_arg(args, double);\
74 break;\
75 case 'F':\
76 argarray[i].f = (float)va_arg(args, double);\
77 break;\
80 } while(0);
82 static jobject JNICALL NewObjectV(JNIEnv* pEnv, jclass clazz, jmethodID methodID, va_list args)
84 jvalue* argarray;
85 MAKE_ARG_ARRAY(pEnv, args, argarray);
86 return (*pEnv)->NewObjectA(pEnv, clazz, methodID, argarray);
89 #define MAKE_METHOD(Type, type) \
90 static type JNICALL Call##Type##Method(JNIEnv* pEnv, jobject obj, jmethodID methodID, ...)\
92 type ret;\
93 va_list args;\
94 va_start(args, methodID);\
95 ret = (*pEnv)->Call##Type##MethodV(pEnv, obj, methodID, args);\
96 va_end(args);\
97 return ret;\
99 static type JNICALL Call##Type##MethodV(JNIEnv* pEnv, jobject obj, jmethodID methodID, va_list args)\
101 jvalue* argarray;\
102 MAKE_ARG_ARRAY(pEnv, args, argarray);\
103 return (*pEnv)->Call##Type##MethodA(pEnv, obj, methodID, argarray);\
105 static type JNICALL CallNonvirtual##Type##Method(JNIEnv* pEnv, jobject obj, jclass clazz, jmethodID methodID, ...)\
107 type ret;\
108 va_list args;\
109 va_start(args, methodID);\
110 ret = (*pEnv)->CallNonvirtual##Type##MethodV(pEnv, obj, clazz, methodID, args);\
111 va_end(args);\
112 return ret;\
114 static type JNICALL CallNonvirtual##Type##MethodV(JNIEnv* pEnv, jobject obj, jclass clazz, jmethodID methodID, va_list args)\
116 jvalue* argarray;\
117 MAKE_ARG_ARRAY(pEnv, args, argarray);\
118 return (*pEnv)->CallNonvirtual##Type##MethodA(pEnv, obj, clazz, methodID, argarray);\
120 static type JNICALL CallStatic##Type##Method(JNIEnv* pEnv, jclass clazz, jmethodID methodID, ...)\
122 type ret;\
123 va_list args;\
124 va_start(args, methodID);\
125 ret = (*pEnv)->CallStatic##Type##MethodV(pEnv, clazz, methodID, args);\
126 va_end(args);\
127 return ret;\
129 static type JNICALL CallStatic##Type##MethodV(JNIEnv* pEnv, jclass clazz, jmethodID methodID, va_list args)\
131 jvalue* argarray;\
132 MAKE_ARG_ARRAY(pEnv, args, argarray);\
133 return (*pEnv)->CallStatic##Type##MethodA(pEnv, clazz, methodID, argarray);\
136 MAKE_METHOD(Object, jobject)
137 MAKE_METHOD(Boolean, jboolean)
138 MAKE_METHOD(Byte, jbyte)
139 MAKE_METHOD(Char, jchar)
140 MAKE_METHOD(Short, jshort)
141 MAKE_METHOD(Int, jint)
142 MAKE_METHOD(Long, jlong)
143 MAKE_METHOD(Float, jfloat)
144 MAKE_METHOD(Double, jdouble)
146 static void JNICALL CallVoidMethod(JNIEnv* pEnv, jobject obj, jmethodID methodID, ...)
148 va_list args;
149 va_start(args, methodID);
150 (*pEnv)->CallVoidMethodV(pEnv, obj, methodID, args);
151 va_end(args);
153 static void JNICALL CallVoidMethodV(JNIEnv* pEnv, jobject obj, jmethodID methodID, va_list args)
155 jvalue* argarray;
156 MAKE_ARG_ARRAY(pEnv, args, argarray);
157 (*pEnv)->CallVoidMethodA(pEnv, obj, methodID, argarray);
159 static void JNICALL CallNonvirtualVoidMethod(JNIEnv* pEnv, jobject obj, jclass clazz, jmethodID methodID, ...)
161 va_list args;
162 va_start(args, methodID);
163 (*pEnv)->CallNonvirtualVoidMethodV(pEnv, obj, clazz, methodID, args);
164 va_end(args);
166 static void JNICALL CallNonvirtualVoidMethodV(JNIEnv* pEnv, jobject obj, jclass clazz, jmethodID methodID, va_list args)
168 jvalue* argarray;
169 MAKE_ARG_ARRAY(pEnv, args, argarray);
170 (*pEnv)->CallNonvirtualVoidMethodA(pEnv, obj, clazz, methodID, argarray);
172 static void JNICALL CallStaticVoidMethod(JNIEnv* pEnv, jclass clazz, jmethodID methodID, ...)
174 va_list args;
175 va_start(args, methodID);
176 (*pEnv)->CallStaticVoidMethodV(pEnv, clazz, methodID, args);
177 va_end(args);
179 static void JNICALL CallStaticVoidMethodV(JNIEnv* pEnv, jclass clazz, jmethodID methodID, va_list args)
181 jvalue* argarray;
182 MAKE_ARG_ARRAY(pEnv, args, argarray);
183 (*pEnv)->CallStaticVoidMethodA(pEnv, clazz, methodID, argarray);
186 static void* JNIEnv_vtable[] =
188 0, // void JNICALL reserved0();
189 0, // void JNICALL reserved1();
190 0, // void JNICALL reserved2();
191 0, // void JNICALL reserved3();
193 0, // jint JNICALL GetVersion();
195 0, // jclass JNICALL DefineClass(const char *name, jobject loader, const jbyte *buf, jsize len);
196 0, // jclass JNICALL FindClass(const char *name);
198 0, // jmethodID JNICALL FromReflectedMethod(jobject method);
199 0, // jfieldID JNICALL FromReflectedField(jobject field);
200 0, // jobject JNICALL ToReflectedMethod(jclass clazz, jmethodID methodID);
202 0, // jclass JNICALL GetSuperclass(jclass sub);
203 0, // jboolean JNICALL IsAssignableFrom(jclass sub, jclass sup);
205 0, // jobject JNICALL ToReflectedField(jclass clazz, jfieldID fieldID);
207 0, // jint JNICALL Throw(jthrowable obj);
208 0, // jint JNICALL ThrowNew(jclass clazz, const char *msg);
209 0, // jthrowable JNICALL ExceptionOccurred();
210 0, // void JNICALL ExceptionDescribe();
211 0, // void JNICALL ExceptionClear();
212 0, // void JNICALL FatalError(const char *msg);
214 0, // jint JNICALL PushLocalFrame(jint capacity);
215 0, // jobject JNICALL PopLocalFrame(jobject result);
217 0, // jobject JNICALL NewGlobalRef(jobject lobj);
218 0, // void JNICALL DeleteGlobalRef(jobject gref);
219 0, // void JNICALL DeleteLocalRef(jobject obj);
220 0, // jboolean JNICALL IsSameObject(jobject obj1, jobject obj2);
222 0, // jobject JNICALL NewLocalRef(jobject ref);
223 0, // jint JNICALL EnsureLocalCapacity(jint capacity);
225 0, // jobject JNICALL AllocObject(jclass clazz);
226 NewObject, // jobject JNICALL NewObject(jclass clazz, jmethodID methodID, ...);
227 NewObjectV, // jobject JNICALL NewObjectV(jclass clazz, jmethodID methodID, va_list args);
228 0, // jobject JNICALL NewObjectA(jclass clazz, jmethodID methodID, jvalue *args);
230 0, // jclass JNICALL GetObjectClass(jobject obj);
231 0, // jboolean JNICALL IsInstanceOf(jobject obj, jclass clazz);
233 0, // jmethodID JNICALL GetMethodID(jclass clazz, const char *name, const char *sig);
235 CallObjectMethod, // jobject JNICALL CallObjectMethod(jobject obj, jmethodID methodID, ...);
236 CallObjectMethodV, // jobject JNICALL CallObjectMethodV(jobject obj, jmethodID methodID, va_list args);
237 0, // jobject JNICALL CallObjectMethodA(jobject obj, jmethodID methodID, jvalue * args);
239 CallBooleanMethod, // jboolean JNICALL CallBooleanMethod(jobject obj, jmethodID methodID, ...);
240 CallBooleanMethodV, // jboolean JNICALL CallBooleanMethodV(jobject obj, jmethodID methodID, va_list args);
241 0, // jboolean JNICALL CallBooleanMethodA(jobject obj, jmethodID methodID, jvalue * args);
243 CallByteMethod, // jbyte JNICALL CallByteMethod(jobject obj, jmethodID methodID, ...);
244 CallByteMethodV, // jbyte JNICALL CallByteMethodV(jobject obj, jmethodID methodID, va_list args);
245 0, // jbyte JNICALL CallByteMethodA(jobject obj, jmethodID methodID, jvalue *args);
247 CallCharMethod, // jchar JNICALL CallCharMethod(jobject obj, jmethodID methodID, ...);
248 CallCharMethodV, // jchar JNICALL CallCharMethodV(jobject obj, jmethodID methodID, va_list args);
249 0, // jchar JNICALL CallCharMethodA(jobject obj, jmethodID methodID, jvalue *args);
251 CallShortMethod, // jshort JNICALL CallShortMethod(jobject obj, jmethodID methodID, ...);
252 CallShortMethodV, // jshort JNICALL CallShortMethodV(jobject obj, jmethodID methodID, va_list args);
253 0, // jshort JNICALL CallShortMethodA(jobject obj, jmethodID methodID, jvalue *args);
255 CallIntMethod, // jint JNICALL CallIntMethod(jobject obj, jmethodID methodID, ...);
256 CallIntMethodV, // jint JNICALL CallIntMethodV(jobject obj, jmethodID methodID, va_list args);
257 0, // jint JNICALL CallIntMethodA(jobject obj, jmethodID methodID, jvalue *args);
259 CallLongMethod, // jlong JNICALL CallLongMethod(jobject obj, jmethodID methodID, ...);
260 CallLongMethodV, // jlong JNICALL CallLongMethodV(jobject obj, jmethodID methodID, va_list args);
261 0, // jlong JNICALL CallLongMethodA(jobject obj, jmethodID methodID, jvalue *args);
263 CallFloatMethod, // jfloat JNICALL CallFloatMethod(jobject obj, jmethodID methodID, ...);
264 CallFloatMethodV, // jfloat JNICALL CallFloatMethodV(jobject obj, jmethodID methodID, va_list args);
265 0, // jfloat JNICALL CallFloatMethodA(jobject obj, jmethodID methodID, jvalue *args);
267 CallDoubleMethod, // jdouble JNICALL CallDoubleMethod(jobject obj, jmethodID methodID, ...);
268 CallDoubleMethodV, // jdouble JNICALL CallDoubleMethodV(jobject obj, jmethodID methodID, va_list args);
269 0, // jdouble JNICALL CallDoubleMethodA(jobject obj, jmethodID methodID, jvalue *args);
271 CallVoidMethod, // void JNICALL CallVoidMethod(jobject obj, jmethodID methodID, ...);
272 CallVoidMethodV, // void JNICALL CallVoidMethodV(jobject obj, jmethodID methodID, va_list args);
273 0, // void JNICALL CallVoidMethodA(jobject obj, jmethodID methodID, jvalue * args);
275 CallNonvirtualObjectMethod, // jobject JNICALL CallNonvirtualObjectMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
276 CallNonvirtualObjectMethodV, // jobject JNICALL CallNonvirtualObjectMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
277 0, // jobject JNICALL CallNonvirtualObjectMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue * args);
279 CallNonvirtualBooleanMethod, // jboolean JNICALL CallNonvirtualBooleanMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
280 CallNonvirtualBooleanMethodV, // jboolean JNICALL CallNonvirtualBooleanMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
281 0, // jboolean JNICALL CallNonvirtualBooleanMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue * args);
283 CallNonvirtualByteMethod, // jbyte JNICALL CallNonvirtualByteMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
284 CallNonvirtualByteMethodV, // jbyte JNICALL CallNonvirtualByteMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
285 0, // jbyte JNICALL CallNonvirtualByteMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
287 CallNonvirtualCharMethod, // jchar JNICALL CallNonvirtualCharMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
288 CallNonvirtualCharMethodV, // jchar JNICALL CallNonvirtualCharMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
289 0, // jchar JNICALL CallNonvirtualCharMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
291 CallNonvirtualShortMethod, // jshort JNICALL CallNonvirtualShortMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
292 CallNonvirtualShortMethodV, // jshort JNICALL CallNonvirtualShortMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
293 0, // jshort JNICALL CallNonvirtualShortMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
295 CallNonvirtualIntMethod, // jint JNICALL CallNonvirtualIntMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
296 CallNonvirtualIntMethodV, // jint JNICALL CallNonvirtualIntMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
297 0, // jint JNICALL CallNonvirtualIntMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
299 CallNonvirtualLongMethod, // jlong JNICALL CallNonvirtualLongMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
300 CallNonvirtualLongMethodV, // jlong JNICALL CallNonvirtualLongMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
301 0, // jlong JNICALL CallNonvirtualLongMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
303 CallNonvirtualFloatMethod, // jfloat JNICALL CallNonvirtualFloatMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
304 CallNonvirtualFloatMethodV, // jfloat JNICALL CallNonvirtualFloatMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
305 0, // jfloat JNICALL CallNonvirtualFloatMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
307 CallNonvirtualDoubleMethod, // jdouble JNICALL CallNonvirtualDoubleMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
308 CallNonvirtualDoubleMethodV, // jdouble JNICALL CallNonvirtualDoubleMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
309 0, // jdouble JNICALL CallNonvirtualDoubleMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue *args);
311 CallNonvirtualVoidMethod, // void JNICALL CallNonvirtualVoidMethod(jobject obj, jclass clazz, jmethodID methodID, ...);
312 CallNonvirtualVoidMethodV, // void JNICALL CallNonvirtualVoidMethodV(jobject obj, jclass clazz, jmethodID methodID, va_list args);
313 0, // void JNICALL CallNonvirtualVoidMethodA(jobject obj, jclass clazz, jmethodID methodID, jvalue * args);
315 0, // jfieldID JNICALL GetFieldID(jclass clazz, const char *name, const char *sig);
317 0, // jobject JNICALL GetObjectField(jobject obj, jfieldID fieldID);
318 0, // jboolean JNICALL GetBooleanField(jobject obj, jfieldID fieldID);
319 0, // jbyte JNICALL GetByteField(jobject obj, jfieldID fieldID);
320 0, // jchar JNICALL GetCharField(jobject obj, jfieldID fieldID);
321 0, // jshort JNICALL GetShortField(jobject obj, jfieldID fieldID);
322 0, // jint JNICALL GetIntField(jobject obj, jfieldID fieldID);
323 0, // jlong JNICALL GetLongField(jobject obj, jfieldID fieldID);
324 0, // jfloat JNICALL GetFloatField(jobject obj, jfieldID fieldID);
325 0, // jdouble JNICALL GetDoubleField(jobject obj, jfieldID fieldID);
327 0, // void JNICALL SetObjectField(jobject obj, jfieldID fieldID, jobject val);
328 0, // void JNICALL SetBooleanField(jobject obj, jfieldID fieldID, jboolean val);
329 0, // void JNICALL SetByteField(jobject obj, jfieldID fieldID, jbyte val);
330 0, // void JNICALL SetCharField(jobject obj, jfieldID fieldID, jchar val);
331 0, // void JNICALL SetShortField(jobject obj, jfieldID fieldID, jshort val);
332 0, // void JNICALL SetIntField(jobject obj, jfieldID fieldID, jint val);
333 0, // void JNICALL SetLongField(jobject obj, jfieldID fieldID, jlong val);
334 0, // void JNICALL SetFloatField(jobject obj, jfieldID fieldID, jfloat val);
335 0, // void JNICALL SetDoubleField(jobject obj, jfieldID fieldID, jdouble val);
337 0, // jmethodID JNICALL GetStaticMethodID(jclass clazz, const char *name, const char *sig);
339 CallStaticObjectMethod, // jobject JNICALL CallStaticObjectMethod(jclass clazz, jmethodID methodID, ...);
340 CallStaticObjectMethodV, // jobject JNICALL CallStaticObjectMethodV(jclass clazz, jmethodID methodID, va_list args);
341 0, // jobject JNICALL CallStaticObjectMethodA(jclass clazz, jmethodID methodID, jvalue *args);
343 CallStaticBooleanMethod, // jboolean JNICALL CallStaticBooleanMethod(jclass clazz, jmethodID methodID, ...);
344 CallStaticBooleanMethodV, // jboolean JNICALL CallStaticBooleanMethodV(jclass clazz, jmethodID methodID, va_list args);
345 0, // jboolean JNICALL CallStaticBooleanMethodA(jclass clazz, jmethodID methodID, jvalue *args);
347 CallStaticByteMethod, // jbyte JNICALL CallStaticByteMethod(jclass clazz, jmethodID methodID, ...);
348 CallStaticByteMethodV, // jbyte JNICALL CallStaticByteMethodV(jclass clazz, jmethodID methodID, va_list args);
349 0, // jbyte JNICALL CallStaticByteMethodA(jclass clazz, jmethodID methodID, jvalue *args);
351 CallStaticCharMethod, // jchar JNICALL CallStaticCharMethod(jclass clazz, jmethodID methodID, ...);
352 CallStaticCharMethodV, // jchar JNICALL CallStaticCharMethodV(jclass clazz, jmethodID methodID, va_list args);
353 0, // jchar JNICALL CallStaticCharMethodA(jclass clazz, jmethodID methodID, jvalue *args);
355 CallStaticShortMethod, // jshort JNICALL CallStaticShortMethod(jclass clazz, jmethodID methodID, ...);
356 CallStaticShortMethodV, // jshort JNICALL CallStaticShortMethodV(jclass clazz, jmethodID methodID, va_list args);
357 0, // jshort JNICALL CallStaticShortMethodA(jclass clazz, jmethodID methodID, jvalue *args);
359 CallStaticIntMethod, // jint JNICALL CallStaticIntMethod(jclass clazz, jmethodID methodID, ...);
360 CallStaticIntMethodV, // jint JNICALL CallStaticIntMethodV(jclass clazz, jmethodID methodID, va_list args);
361 0, // jint JNICALL CallStaticIntMethodA(jclass clazz, jmethodID methodID, jvalue *args);
363 CallStaticLongMethod, // jlong JNICALL CallStaticLongMethod(jclass clazz, jmethodID methodID, ...);
364 CallStaticLongMethodV, // jlong JNICALL CallStaticLongMethodV(jclass clazz, jmethodID methodID, va_list args);
365 0, // jlong JNICALL CallStaticLongMethodA(jclass clazz, jmethodID methodID, jvalue *args);
367 CallStaticFloatMethod, // jfloat JNICALL CallStaticFloatMethod(jclass clazz, jmethodID methodID, ...);
368 CallStaticFloatMethodV, // jfloat JNICALL CallStaticFloatMethodV(jclass clazz, jmethodID methodID, va_list args);
369 0, // jfloat JNICALL CallStaticFloatMethodA(jclass clazz, jmethodID methodID, jvalue *args);
371 CallStaticDoubleMethod, // jdouble JNICALL CallStaticDoubleMethod(jclass clazz, jmethodID methodID, ...);
372 CallStaticDoubleMethodV, // jdouble JNICALL CallStaticDoubleMethodV(jclass clazz, jmethodID methodID, va_list args);
373 0, // jdouble JNICALL CallStaticDoubleMethodA(jclass clazz, jmethodID methodID, jvalue *args);
375 CallStaticVoidMethod, // void JNICALL CallStaticVoidMethod(jclass cls, jmethodID methodID, ...);
376 CallStaticVoidMethodV, // void JNICALL CallStaticVoidMethodV(jclass cls, jmethodID methodID, va_list args);
377 0, // void JNICALL CallStaticVoidMethodA(jclass cls, jmethodID methodID, jvalue * args);
379 0, // jfieldID JNICALL GetStaticFieldID(jclass clazz, const char *name, const char *sig);
381 0, // jobject JNICALL GetObjectField(jobject obj, jfieldID fieldID);
382 0, // jboolean JNICALL GetBooleanField(jobject obj, jfieldID fieldID);
383 0, // jbyte JNICALL GetByteField(jobject obj, jfieldID fieldID);
384 0, // jchar JNICALL GetCharField(jobject obj, jfieldID fieldID);
385 0, // jshort JNICALL GetShortField(jobject obj, jfieldID fieldID);
386 0, // jint JNICALL GetIntField(jobject obj, jfieldID fieldID);
387 0, // jlong JNICALL GetLongField(jobject obj, jfieldID fieldID);
388 0, // jfloat JNICALL GetFloatField(jobject obj, jfieldID fieldID);
389 0, // jdouble JNICALL GetDoubleField(jobject obj, jfieldID fieldID);
391 0, // void JNICALL SetObjectField(jobject obj, jfieldID fieldID, jobject val);
392 0, // void JNICALL SetBooleanField(jobject obj, jfieldID fieldID, jboolean val);
393 0, // void JNICALL SetByteField(jobject obj, jfieldID fieldID, jbyte val);
394 0, // void JNICALL SetCharField(jobject obj, jfieldID fieldID, jchar val);
395 0, // void JNICALL SetShortField(jobject obj, jfieldID fieldID, jshort val);
396 0, // void JNICALL SetIntField(jobject obj, jfieldID fieldID, jint val);
397 0, // void JNICALL SetLongField(jobject obj, jfieldID fieldID, jlong val);
398 0, // void JNICALL SetFloatField(jobject obj, jfieldID fieldID, jfloat val);
399 0, // void JNICALL SetDoubleField(jobject obj, jfieldID fieldID, jdouble val);
401 0, // jstring JNICALL NewString(const jchar *unicode, jsize len);
402 0, // jsize JNICALL GetStringLength(jstring str);
403 0, // const jchar *JNICALL GetStringChars(jstring str, jboolean *isCopy);
404 0, // void JNICALL ReleaseStringChars(jstring str, const jchar *chars);
406 0, // jstring JNICALL NewStringUTF(const char *utf);
407 0, // jsize JNICALL GetStringUTFLength(jstring str);
408 0, // const char* JNICALL GetStringUTFChars(jstring str, jboolean *isCopy);
409 0, // void JNICALL ReleaseStringUTFChars(jstring str, const char* chars);
411 0, // jsize JNICALL GetArrayLength(jarray array);
413 0, // jobjectArray JNICALL NewObjectArray(jsize len, jclass clazz, jobject init);
414 0, // jobject JNICALL GetObjectArrayElement(jobjectArray array, jsize index);
415 0, // void JNICALL SetObjectArrayElement(jobjectArray array, jsize index, jobject val);
417 0, // jbooleanArray JNICALL NewBooleanArray(jsize len);
418 0, // jbyteArray JNICALL NewByteArray(jsize len);
419 0, // jcharArray JNICALL NewCharArray(jsize len);
420 0, // jshortArray JNICALL NewShortArray(jsize len);
421 0, // jintArray JNICALL NewIntArray(jsize len);
422 0, // jlongArray JNICALL NewLongArray(jsize len);
423 0, // jfloatArray JNICALL NewFloatArray(jsize len);
424 0, // jdoubleArray JNICALL NewDoubleArray(jsize len);
426 0, // jboolean * JNICALL GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy);
427 0, // jbyte * JNICALL GetByteArrayElements(jbyteArray array, jboolean *isCopy);
428 0, // jchar * JNICALL GetCharArrayElements(jcharArray array, jboolean *isCopy);
429 0, // jshort * JNICALL GetShortArrayElements(jshortArray array, jboolean *isCopy);
430 0, // jint * JNICALL GetIntArrayElements(jintArray array, jboolean *isCopy);
431 0, // jlong * JNICALL GetLongArrayElements(jlongArray array, jboolean *isCopy);
432 0, // jfloat * JNICALL GetFloatArrayElements(jfloatArray array, jboolean *isCopy);
433 0, // jdouble * JNICALL GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy);
435 0, // void JNICALL ReleaseBooleanArrayElements(jbooleanArray array, jboolean *elems, jint mode);
436 0, // void JNICALL ReleaseByteArrayElements(jbyteArray array, jbyte *elems, jint mode);
437 0, // void JNICALL ReleaseCharArrayElements(jcharArray array, jchar *elems, jint mode);
438 0, // void JNICALL ReleaseShortArrayElements(jshortArray array, jshort *elems, jint mode);
439 0, // void JNICALL ReleaseIntArrayElements(jintArray array, jint *elems, jint mode);
440 0, // void JNICALL ReleaseLongArrayElements(jlongArray array, jlong *elems, jint mode);
441 0, // void JNICALL ReleaseFloatArrayElements(jfloatArray array, jfloat *elems, jint mode);
442 0, // void JNICALL ReleaseDoubleArrayElements(jdoubleArray array, jdouble *elems, jint mode);
444 0, // void JNICALL GetBooleanArrayRegion(jbooleanArray array, jsize start, jsize l, jboolean *buf);
445 0, // void JNICALL GetByteArrayRegion(jbyteArray array, jsize start, jsize len, jbyte *buf);
446 0, // void JNICALL GetCharArrayRegion(jcharArray array, jsize start, jsize len, jchar *buf);
447 0, // void JNICALL GetShortArrayRegion(jshortArray array, jsize start, jsize len, jshort *buf);
448 0, // void JNICALL GetIntArrayRegion(jintArray array, jsize start, jsize len, jint *buf);
449 0, // void JNICALL GetLongArrayRegion(jlongArray array, jsize start, jsize len, jlong *buf);
450 0, // void JNICALL GetFloatArrayRegion(jfloatArray array, jsize start, jsize len, jfloat *buf);
451 0, // void JNICALL GetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, jdouble *buf);
453 0, // void JNICALL SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize l, jboolean *buf);
454 0, // void JNICALL SetByteArrayRegion(jbyteArray array, jsize start, jsize len, jbyte *buf);
455 0, // void JNICALL SetCharArrayRegion(jcharArray array, jsize start, jsize len, jchar *buf);
456 0, // void JNICALL SetShortArrayRegion(jshortArray array, jsize start, jsize len, jshort *buf);
457 0, // void JNICALL SetIntArrayRegion(jintArray array, jsize start, jsize len, jint *buf);
458 0, // void JNICALL SetLongArrayRegion(jlongArray array, jsize start, jsize len, jlong *buf);
459 0, // void JNICALL SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, jfloat *buf);
460 0, // void JNICALL SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, jdouble *buf);
462 0, // jint JNICALL RegisterNatives(jclass clazz, const JNINativeMethod *methods, jint nMethods);
463 0, // jint JNICALL UnregisterNatives(jclass clazz);
465 0, // jint JNICALL MonitorEnter(jobject obj);
466 0, // jint JNICALL MonitorExit(jobject obj);
468 0, // jint JNICALL GetJavaVM(JavaVM **vm);
470 0, // void JNICALL GetStringRegion(jstring str, jsize start, jsize len, jchar *buf);
471 0, // void JNICALL GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf);
473 0, // void* JNICALL GetPrimitiveArrayCritical(jarray array, jboolean *isCopy);
474 0, // void JNICALL ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode);
476 0, // const jchar* JNICALL GetStringCritical(jstring string, jboolean *isCopy);
477 0, // void JNICALL ReleaseStringCritical(jstring string, const jchar *cstring);
479 0, // jweak JNICALL NewWeakGlobalRef(jobject obj);
480 0, // void JNICALL DeleteWeakGlobalRef(jweak ref);
482 0, // jboolean JNICALL ExceptionCheck();
484 0, // jobject JNICALL NewDirectByteBuffer(void* address, jlong capacity);
485 0, // void* JNICALL GetDirectBufferAddress(jobject buf);
486 0 // jlong JNICALL GetDirectBufferCapacity(jobject buf);
489 JNIEXPORT void** JNICALL ikvm_GetJNIEnvVTable()
491 return JNIEnv_vtable;
494 JNIEXPORT void* JNICALL ikvm_MarshalDelegate(void* p)
496 return p;
499 typedef jint (JNICALL *PJNI_ONLOAD)(JavaVM* vm, void* reserved);
501 JNIEXPORT jint JNICALL ikvm_CallOnLoad(PJNI_ONLOAD method, JavaVM* vm, void* reserved)
503 return method(vm, reserved);