invoke methods at defered time - timing problems
Hello !
My C code contains two functions to implement JNI for Java methods invocation :
- InitFunction loads JVM and stores class to call :
{
JNI_CreateJavaVM(...)
cls= ...->FindClass(...)
/* g_cls is a global variable */
g_cls = ...->NewGlobalRef(..., cls)
/* g_myMethod is a global variable */
g_myMethodID = ->GetStaticMethodID(..., g_cls, method, ...)
}
- CallFunction invokes java method
{
...
...->CallStaticVoidMethod( ..., g_cls, g_myMethodID, args ) ;
}
When CallFunction is run inside InitFunction, no problem occurs.
But when it is called later, it doesn't, raising a error.
Do I have to store jni-environment variable in a global reference, I can I do this?
Thank you for help!
JCC

