I'm creating Java wrappers for some C code using JNI. There are dependencies on the C side that look like this:
a = make_a();
b = make_b(a);
On the Java side I use class A
and class B
to hold references to the output of make_a()
and make_b
, along with various operations. Further, class B
depends class A
sticking around.
How can I create a dependency between the two classes from within JNI?
Update
I need class A to not be GC'd while class B is in use, and I need to create this dependency from within JNI.