Filling up a Vector & returning it...

G

gautam.chavan

hello all,

I have a C++ file, which calls a c++ library which returns
a Vector<Struct>
My C++ File is invoked via a Jni call...
Instead of returning an Object array back to my Java Class,
i want to return a vector...
Can I pass a refrence to a Vector to my C++ file, which it
can fill up...
is this possible ???

regards and thanks,
gautam.
 
G

Gordon Beaton

I have a C++ file, which calls a c++ library which returns a
Vector<Struct>. My C++ File is invoked via a Jni call... Instead of
returning an Object array back to my Java Class, i want to return a
vector... Can I pass a refrence to a Vector to my C++ file, which it
can fill up... is this possible ???

Yes, it's possible. An alternative is to let the C++ function itself
create the Java Vector, fill it and return it.

Within your native method, JNI lets you invoke any constructors or
methods in any Java class, just like you can from Java. Just the
syntax is more complicated.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top