* Register native JNI-callable methods. * * "className" looks like "java/lang/String". */
| 558 | * "className" looks like "java/lang/String". |
| 559 | */ |
| 560 | static int jniRegisterNativeMethods(JNIEnv* env, const char* className, |
| 561 | const JNINativeMethod* gMethods, int numMethods) |
| 562 | { |
| 563 | jclass clazz; |
| 564 | |
| 565 | LOGV("Registering %s natives\n", className); |
| 566 | clazz = env->FindClass(className); |
| 567 | if (clazz == NULL) { |
| 568 | LOGE("Native registration unable to find class '%s'\n", className); |
| 569 | return -1; |
| 570 | } |
| 571 | if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) { |
| 572 | LOGE("RegisterNatives failed for '%s'\n", className); |
| 573 | return -1; |
| 574 | } |
| 575 | return 0; |
| 576 | } |
| 577 | |
| 578 | |
| 579 | jint JNI_OnLoad(JavaVM* vm, void* reserved) |