Passing array from java to dll function with JNA
问题 I want to pass Java array as parameter to c dll throw JNA , here is my code : import com.sun.jna.*; public class Javatest { public interface CLibrary extends Library { CLibrary INSTANCE = (CLibrary) Native.loadLibrary( "test", CLibrary.class); void test(Pointer p,int width); } public static void main(String[] args) { Pointer p = new Memory(5*Native.getNativeSize(Double.TYPE)); for (int i = 0; i < 5; i++) { p.setDouble(i*Native.getNativeSize(Double.TYPE),5); } CLibrary.INSTANCE.test(p,5); } }