Why don't you want to use extern "C"?  You only need to use it for the
"glue" methods between your C++ code and the JVM.

On Jul 16, 7:22 pm, ferar <[email protected]> wrote:
> android-ndk-r4/samples/hello-jni  as is works fine. However, if I
> rename /hello-jni/jni/hello-jni.c to /hello-jni/jni/hello-jni.cpp,
> Modify the code in that file as following:
> -----------------------------------------
> include <string.h>
> #include <jni.h>
>
> /* This is a trivial JNI example where we use a native method
>  * to return a new VM String. See the corresponding Java source
>  * file located at:
>  *
>  *   apps/samples/hello-jni/project/src/com/example/HelloJni/
> HelloJni.java
>  */
> jstring
> Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
>                                                   jobject thiz )
> {
>     return env->NewStringUTF("Hello from JNI !");
>
> }
>
> -------------------------
> modify Android.mk to compile ello-jni.cpp, after successfully building
> the native library, then the hello-jni project.
>
> the problem occurs when trying to run hello-jni, a run-time exception
> occurs related to UnsatisfiedLinkError !
>
> is there a way to use *cpp* files *without* resorting to extern "C" to
> disable mangling for android project?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to