Thanks, I had run JNI successful :)

1st,there are mistake of library name, I use
System.loadLibrary("libNativeAdd");to load library,
2st, lack of libgcc.a while linking,

“ - when you create an executable (either static or dynamic) *or* a
   shared library, link it to this libgcc.a. this means that the
aeabi
   functions required by the executable/library are directly copied
into it.
   yes, this also means that these functions will be duplicated in the
process
   space of a program that links to several shared libraries requiring
them.
   note that libgcc.a must appear last in your link command. ”

If I build shared library without "libgcc.a" but instead of "-static",
why it cann't duplicated aeabi functions to my library?


arm-none-linux-gnueabi-gcc  -I/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/
include/linux/ -I/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/include -I/usr/
lib/gcc/x86_64-redhat-linux/4.1.2/include/  -fpic -c
project_testjni_NativeAdd.c

arm-none-linux-gnueabi-ld -r -static -o libNativeAdd.so.tmp
project_testjni_NativeAdd.o ../arm-2007q3/lib/gcc/arm-none-linux-
gnueabi/4.2.1/libgcc.a

arm-none-linux-gnueabi-ld -shared -Tarmelf_linux_eabi.xsc -o
libNativeAdd.so libNativeAdd.so.tmp


On 4月10日, 下午6时25分, David Given <[EMAIL PROTECTED]> wrote:
> Macro wrote:
>
> [...]
>
> > My shared library name is "libNativeAdd.so", but system doesn't find
> > it ?
> > Need I register it somewhere?
>
> Your log doesn't show you loading the library --- you are calling
> System.loadLibrary("NativeAdd"), aren't you?
>
> If there are unresolved symbols, loadLibrary() will throw
> UnsatisfiedLinkError. If your library loads but doesn't contain an
> appropriate implementation of a native method, you'll get
> UnsatisfiedLinkError when you call the native method (which I think is
> what's happening here).
>
> --
> David Given
> [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to