Native Object Persistence?

Hi, I think I already know the answer to this but I was wondering if this scenario can happen using JNI:

1. A Java class calls a C/C++ native function (via JNI).

2. The C/C++ native function does some stuff and creates an object in memory (on the C side).

3. Return goes back to the calling Java class.

4. Some time later the Java class wants to access that object that was created in step 2. Can it?

I was thinking that the C function can return the value of the address of the object that was created back to the Java calling class. The value would mean nothing to the Java side but it could later pass that value back down to another native function which can use it to look up that previously created object.

Hope what I'm trying to say is clear!

Thanks for any help,

Mike

osganian@yahoo.com

[864 byte] By [osganian] at [2007-9-26 3:15:06]
# 1
I believe this topic was covered in a recent JDC Tech Tips. The actual example was creating C++ objects that are shadowed by Java objects. In any case, they showed how to save a pointer to the object inside java, and be able to reuse the data on a later call into C++.
bschauwe at 2007-6-29 11:26:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...