开发者

How to declare native methods when calling a static method of a prebuilt library in it?

when i am using

#include<jni.h>
#include "convert.h"
#include "com_jniso_CallJni.h"
#include<stdio.h>
JNIEXPORT  void JNICALL Java_com_jniso_CallJni_takeint(JNIEnv *env,jclass c)
{
    setint();
}
JNIEXPORT  jint JNICALL Java_com_jniso_CallJni_takedouble(JNIEnv *env,jclass c)
{
    return getdouble();
}

i am getting error at compile time

Compile arm    : Met <= Methodscall.c
D:/workspace/methods/jni/convert.h:3: warning: 'setint' used but never defined
D:/workspace/methods/jni/convert.h:4: warning: 'getdouble' used but never defi
d
SharedLibrary  : libMet.so
D:/workspace/methods/obj/local/armeabi/objs/Met/Methodscall.o: In function `Java
_com_jniso_CallJni_takedouble':
D:/workspace/methods/jni/Methodscall.c:11: undefined reference to `getdouble'
D:/workspace/methods/obj/local/armeabi/objs/Met/Methodscall.o: In function `Java
_com_jniso_CallJni_takeint':
D:/workspace/methods/jni/Methodscall.c:7: undefined reference to `setint'
collect2: ld returned 1 exit status
make: *** [/cygdrive/d/workspace/methods/obj/local/armeabi/libMe开发者_开发技巧t.so] Error 1

If i mentioned static in native declaration . It is compiled successfully. But while running i am getting

UnsatisfiedLinkError. WARN/dalvikvm(1230): No implementation found for native Lcom/corpus/NativeLib;.setint()V

Please help me Thanks & Regards


I used .so file as shared library.From a shared library we can not able to call a static method.And in the above My library is not included properly.Because the format is not compatible to android.Hence it is not worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜