简体   繁体   中英

How to write a java object to a jobject array in JNI?

I want my native function to take the java object as parameter and write it to jobject array in shared memory for the use of another process. How can I do this ? Thanks.

You cannot share a Java object across processes. The object lives in a VM and two processes have separate VMs. (Or your second process might not have a VM at all.)

You will have to extract all instances variables / properties from the Java object, put them in a struct (or a similar data structure) and share the struct .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM