Thursday, March 26, 2009

JNIEnv is only good for the duration of a Java->C++ call

I was trying to make JNIEnv a property of a C++ class, stored by a singleton.
This can't work, because JNIEnv is only valid for the duration of a Java->C++ call.
Apparently each instance is related to a particular Java thread.
Super bummer. Now I must figure out a new way for C++ to call into a running Java process.

And I was feeling so good about my clever Ant task that could insert user-defined source code into the body of generated JNI glue functions....

No comments:

Post a Comment