gcc -g -dynamiclib -framework JavaVM src/cReverse.o src/jni.o -o
out/production/Cjni/libCjni.jnilib
....
I'm calling System.loadLibrary("CjniLib") with a library file named
"libCjniLib.jnilib", although when I try calling System.load
(basePath + "libCjniLib.jnilib"), ...
These are inconsistent.
The output from gcc is named "libCjni.jnilib". For System.loadLibrary
(), you would use "Cjni" to load this lib, not "CjniLib".
There is a similar problem with the path you pass to System.load().
The filename simply doesn't match what gcc is producing.
Maybe you renamed gcc's output file to "libCjniLib.jnilib". But if
you didn't, you're using the wrong lib name in the Java code. If
that's the problem, I recommend naming the lib something more
consistent with its purpose and less repetitive. Even "Fubar" would
be better than what you have now.
The following works perfectly for me.
-- GG
File Piddy.java
-----
public class Piddy
{
public static void main( String[] args )
{
System.out.println( "java.library.path = "
+ System.getProperty( "java.library.path" ) );
gcc -x c \
-I/System/Library/Frameworks/JavaVM.framework/Headers \
-c Piddy.c -o Piddy.o
gcc -dynamiclib -o libPiddy.jnilib Piddy.o
java Piddy
file lib*
## end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden