equal
deleted
inserted
replaced
25 #include <stdio.h> |
25 #include <stdio.h> |
26 |
26 |
27 extern "C" { |
27 extern "C" { |
28 |
28 |
29 /* |
29 /* |
30 * A C function that takes a reference to java Object( a circular Linked list) |
30 * A C function that takes a reference to java Object (a circular Linked list) |
31 * and utilizes this reference to do a java method callback to determine the |
31 * and utilizes this reference to do a java method callback to determine the |
32 * number of elements in the linked list |
32 * number of elements in the linked list |
33 */ |
33 */ |
34 JNIEXPORT jint JNICALL |
34 JNIEXPORT jint JNICALL |
35 Java_gc_gctests_nativeGC01_nativeGC01_nativeMethod01 |
35 Java_gc_gctests_nativeGC01_nativeGC01_nativeMethod01 |
53 that counts the number of elements in the |
53 that counts the number of elements in the |
54 circular linked list |
54 circular linked list |
55 */ |
55 */ |
56 |
56 |
57 clss = env->GetObjectClass(linked_list); |
57 clss = env->GetObjectClass(linked_list); |
58 mid2 = env->GetMethodID(clss, "getLength", "()I" ); |
58 mid2 = env->GetMethodID(clss, "getLength", "()I"); |
59 if (mid2 == 0) { |
59 if (mid2 == 0) { |
60 printf("couldnt locate method getLength()"); |
60 printf("couldnt locate method getLength()"); |
61 return -1; |
61 return -1; |
62 } |
62 } |
63 elementCount = env->CallIntMethod(linked_list, mid2); |
63 elementCount = env->CallIntMethod(linked_list, mid2); |
64 return elementCount; |
64 return elementCount; |