Category: jni

  • Reducing redundant code by wrapping JNI functions.

    My HelloWorldNative.c, with the “nativePrintObject” function reduced by wrapping the object and integer field retrieval: JNIEXPORT void JNICALL Java_helloworld_Main_nativePrintObject(JNIEnv *env, jobject ths, jobject wsv){ jint ipAddress; jstring jPageVisited; char *pageVisited; jstring jRefererURL; char *refererURL; jobject ipObject; ipAddress = getIntegerField(env, wsv, “ipAddress”); printf(” wsv.ipAddress = %d.%d.%d.%dn”, ( ipAddress & 0xff000000 ) >> 24, ( ipAddress & […]