If I call a native method with the memory address and the type of data stored at that address, how can i create a pointer to that address in JNI?
In Java:
pointers(long.class, 810234092817);
In JNI:
JNIEXPORT jlong JNICALL Java_JNIFoo_pointers
(JNIEnv *env, jobject obj, jclass cls, jlong addr) {
// if cls is long, then i want to dynamically create the following
// b/c i know the data at *addr* is of type *cls*.
// This works.
jlong* p = (jlong *) addr;
// jclass has the class type and addr has the actual address. But I can't do this
(cls*) p = (cls *) addr;
}
How can i create a pointer to jlong
address of type jclass
?