Thanks guys. I should have been more specific. Will look through the
On Oct 15, 12:28 pm, fadden <
fad...@android.com> wrote:
> On Oct 15, 11:13 am, George <
bipi...@gmail.com> wrote:
>
> > The samples in the NDK show how to pass simple parameters from the
> > Java layer to native. With the NDK, can someone give me an example of
> > passing, say, a Rect from Java to native?
>
> The parameter type will be "jobject". Pass it like anything else.
> Some specialization is provided for class objects, arrays, and
> primitive arrays.
>
> > Currently, the NDK eliminated the need to register the native function
> > on JNI_Load by following a naming convention for the functions.
> > Example: com.example.SanAngeles.DemoRenderer.nativeRender became
> > Java_com_example_SanAngeles_DemoRenderer_nativeRender. Does the NDK
> > provide any such shortcuts even when passing objects?
>
> I'm not entirely sure what you're asking. An unambiguous method
> doesn't include the parameter types in the signature name, so the arg
> types don't matter. If the method is overloaded you may have to
> include the "mangled" signature; see:
>
>
> > Also, can anyone point me to any examples using the NDK with C++ - I
> > am particularly interested in the lifecycle management of the native
> > objects created. Example: Let's say I want to create a mirror Rect
> > object in native for the Rect Java object and off-load all the
> > functionality to native C++ object. When do I create the native Rect
> > object, when do I destroy it?
>
> I'm not sure what this means and why it applies particularly to C++.
> If you can't find your answer in the various references, please
> describe what you're after in more detail.
>
> Some links:
>
>
http://java.sun.com/docs/books/jni/html/jniTOC.html
>
http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html
..