>libHelloNative.so: HelloNative.c HelloNative.h 
> gcc -c -o libHelloNative.so \ 
> -static \ 
> -I/usr/java/include \ 
> -I/usr/java/include/genunix \ 
> HelloNative.c 
>
You don't have the right compiler options here. In the ELF-HOWTO
(maintained by [EMAIL PROTECTED]), you find the following guidelines
for creating shared libraries under paragraph 3.2, Building Libraries:

>To build libfoo.so as a shared library, the basic steps look like this: 
> 
> $ gcc -fPIC -c *.c 
> $ gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o 
> $ ln -s libfoo.so.1.0 libfoo.so.1 
> $ ln -s libfoo.so.1 libfoo.so 
> $ export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH 
> 
>This will generate a shared library called libfoo.so.1.0, and the
>appropriate links for ld (libfoo.so) and the dynamic linker 
>(libfoo.so.1) to find it. To test, we add the current directory to
LD_LIBRARY_PATH. 
> 
>When you're happpy that the library works, you'll have to move it to, say,
>/usr/local/lib, and recreate the appropriate links. 
>Note that the libfoo.so link should point to libfoo.so.1, so it doesn't
need >updating on every minor version number change. 
>The link from libfoo.so.1 to libfoo.so.1.0 is kept up to date by ldconfig,
which on >most systems is run as part of the 
>boot process. 
> 
> $ su 
> # cp libfoo.so.1.0 /usr/local/lib 
> # /sbin/ldconfig 
> # ( cd /usr/local/lib ; ln -s libfoo.so.1 libfoo.so )

This has always worked nicely for me.

Cheers,

Roel

Reply via email to