I've written a few shared libraries for use under both Linux and Solaris,
and since a few people are curious about this, here goes:

1) Make sure you have run javah.  Plenty of documentation on this exists.
2) You must first compile your C source files to object files, which end
   in ".o".  Example:    gcc -fPIC -c -I<java-header-path> file1.c -o
file1.o
   You must replace <java-header-path> with the path to the include files
   for java-linux.
3) Create your library.  This is not the same as creating an executable.
   Under Linux, use:   ld -shared file1.o -o libMyLib.so
   If you have more than file1.o, just list them after file1.o.

You can then, from Java, load your library as System.loadLibrary("MyLib");

Hope this helps.

Ed Roskos
[EMAIL PROTECTED]



Reply via email to