http://stackoverflow.com/questions/2453692/jni-loses-reference-to-native-methods
void onChange(JNIEnv *, jobject, jfloat);
JNINativeMethod methods[] = {
{"onChange", "(F)V", (void *)onChange}
};
jint JNI_OnLoad(JavaVM *jvm, void *reserved) {
JNIEnv *env;
(*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_4);
jclass inheritance = (*env)->FindClass(env, "Inheritance");
(*env)->RegisterNatives(env, inheritance, methods, 1);
jobject o_inheritance = (*env)->NewObject(env, inheritance, (*env)->GetMethodID(env, inheritance, "<init>", "()V"));
jclass provider = (*env)->FindClass(env, "Provider");
jobject o_provider = (*env)->NewObject(env, provider, (*env)->GetMethodID(env, provider, "<init>", "()V"));
(*env)->CallVoidMethod(env, o_provider, (*env)->GetMethodID(env, provider, "registerChange", "(LListener;)V"), o_inheritance);
(*env)->CallVoidMethod(env, o_provider, (*env)->GetMethodID(env, provider, "sendMsg", "()V"));
return JNI_VERSION_1_4;
}
void onChange(JNIEnv *env, jobject self, jfloat f) {
printf("[C] %f\n", f);
}