C
castillo.bryan
I have some JNI code which uses JNI_OnLoad to cache a pointer to the
JVM, found classes and method ids. I have used the JNI code with IBM's
and Sun's 1.4.2 JDK's on windows and linux. I wrote a JNI_OnUnload
function to delete the global refs to these classes etc... I noticed
that the unload function is never called. Its not much of a problem in
my environment since it usually means the JVM is shutting down anyway.
But I'm still curious why it isn't called. The documentation says that
both functions are optional for a JVM to implement. Is there no real
need to implement JNI_OnUnload?
Anyway this is how I declare the function
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
/* code..... */
}
Am I doing anything wrong or is it just not implemented on the SUN and
IBM JDK's?
JVM, found classes and method ids. I have used the JNI code with IBM's
and Sun's 1.4.2 JDK's on windows and linux. I wrote a JNI_OnUnload
function to delete the global refs to these classes etc... I noticed
that the unload function is never called. Its not much of a problem in
my environment since it usually means the JVM is shutting down anyway.
But I'm still curious why it isn't called. The documentation says that
both functions are optional for a JVM to implement. Is there no real
need to implement JNI_OnUnload?
Anyway this is how I declare the function
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
/* code..... */
}
Am I doing anything wrong or is it just not implemented on the SUN and
IBM JDK's?