This discussion is archived
1 Reply Latest reply: Jul 25, 2007 1:33 PM by 843810 RSS

Usage of SetJNIFunctionTable fails

843810 Newbie
Currently Being Moderated
Hi!

I'm playing with function interception and want to set my own function table. When I leave the line with SetJNIFunctionTable in the code, the JVM crashes at startup. When I remove the line, it starts, but of course without my interception.

What could be wrong? Has anybody used SetJNIFunctionTable successfully? Help appreciated.

Here are parts of the code (beware, it's C ;-) The GetJNIFunctionTable call returns without error.
static jniNativeInterface redirectedJniFunctions;

error = (*jvmti)->GetJNIFunctionTable(jvmti, &redirectedJniFunctions);
redirectedJniFunctions.NewGlobalRef = myNewGlobalRef;
error = (*jvmti)->SetJNIFunctionTable(jvmti, &redirectedJniFunctions);