Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Confused about passing arrays

843829Feb 11 2005 — edited Feb 11 2005
Hi,

I'm stuck, I can't find any answers in the JNI tutorial, or in Sheng Liangs book.

I basically want to pass from Java to a C function a null 2D array of doubles, the C function to create a 2D array of doubles, which it then assigns to the passed array. Sheng Liangs book has an example where a 2D array is returned as a return value, but this doesn't help me since I have functions with more that one return value, so I have to use pass by reference.
Is this even possible with JNI?

Here my Java method signature:
 public native void createCont(int[] noges,
                                                     double[][] probEx,
                                                     double[][] probEx2,
                                                     double root);
I can't assigne probEx or probEx2 to anything other than null before I make this call and I have no idea what size these arrays will be.

Any suggestions here would be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2005
Added on Feb 11 2005
7 comments
272 views