PR18116.c 724 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <stdlib.h>
  2. #include <assert.h>
  3. #include <PR18116.h>
  4. // The purpose of this test is to ensure that signatures with non-top
  5. // level class arguments work.
  6. static jint
  7. some_random_name (JNIEnv *env, jclass k, jobject v)
  8. {
  9. return 555;
  10. }
  11. JNIEXPORT jint JNICALL
  12. JNI_OnLoad (JavaVM *vm, void *nothing)
  13. {
  14. JNIEnv *env;
  15. JNINativeMethod meth;
  16. jclass k;
  17. jint r;
  18. r = (*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_2);
  19. assert (r == JNI_OK);
  20. k = (*env)->FindClass (env, "PR18116");
  21. assert (k != NULL);
  22. meth.name = "doit";
  23. meth.signature = "(Ljava/lang/String;)I";
  24. meth.fnPtr = some_random_name;
  25. r = (*env)->RegisterNatives (env, k, &meth, 1);
  26. assert (r == JNI_OK);
  27. return JNI_VERSION_1_2;
  28. }