Java Reference
In-Depth Information
JNIEXPORT void JNICALL Java_HelloJni_displayHelloWorld(JNIEnv *env,
jobject this);
Then create a C function that does the work. You must use the same function signature as is
used in the .h file.
This function can do whatever it wants. Note that it is passed two arguments: a JVM environ-
ment variable and a handle for the this object. Table 24-1 shows the correspondence
between Java types and the C types (JNI types) used in the C code.
Table 24-1. Java and JNI types
Java type JNI
Java array type JNI
byte
jbyte
byte[]
jbyteArray
short
jshort
short[]
jshortArray
int
jint
int[]
jintArray
long
jlong
long[]
jlongArray
float
jfloat
float[]
jfloatArray
double
jdouble
double[]
jdoubleArray
char
jchar
char[]
jcharArray
boolean
jboolean
boolean[]
jbooleanArray
void
jvoid
Object
jobject
Object[]
jobjectArray
Class
jclass
String
jstring
array
jarray
Throwable
jthrowable
Search WWH ::




Custom Search