Transfer of a java object
Hi;
I search an JNI example with C/C++ to check if it is possible to send a java object with JNI.
I have a class java 揂?with 2 methods:
- getCustomer (): get an java object Customer
- checkCustomer (Customer c): print an Customer object
The external prog (C/++ or other) calls the method 揼etPeronne?to retrieve an Customer object empties, it fills and it must return to java prog via the method checkCustomer or another means to be store in database.
For the 揼etPersonne?method it is OK for my but I would like to know how implement the return of object 揅ustomer?
Regards;
[624 byte] By [
yanis97a] at [2007-10-3 10:27:19]

Your description of who calls who, and when, is very confusing.
But I will assume that what you are trying to do is
o call a C routine via JNI.
o the C routine tries to look up a person, doesn't find one.
o the C routine shoould then create a java Person object and return it.
The way to do this is to have the C routine call into the JVM, asking for a Person to be constructed. It will be returned to the C routine as a jobject, which can in turn be retruned to the original java caller.
Look for the JNI invocation interface. Among many other things in that documentation is how to call a java constructor.