I needed return as a function parameter an array of int plus the length of the array.
#commands relative to src
//compile class
javac -classpath . com/wmmnpr/c2/Pm4.java
//create header file
javah -classpath . com.wmmnpr.c2.Pm4
//compile c code
g++ -fpic -W1,--add-stdcall-alias -I /usr/jdk/jdk1.6.0_06/include -I /us
r/jdk/jdk1.6.0_06/include/solaris -shared -o libpm4lib.so com_wmmnpr_c2_P
m4.c
//compile class using native method(driver)
javac -classpath . com/wmmnpr/app/CallLib.java
//loading of library
in file:
static {
System.loadLibrary("pm4lib");
}
//name of library on disk in working directory (/sa-home/pennoye/jni/src)
libpm4lib.so
//run driver
java -classpath /sa-home/pennoye/jni/src -Djava.library.path=/sa-home/pen
noye/jni/src com.wmmnpr.app.CallLib
The code for the project is here:
No comments:
Post a Comment