Link java to a static library.


See last post, assume testlib has a void hello(void) function.

Step 1: Create a wrapper class.
public class TestLibWrapper {
public static native void hello();

static {
System.loadLibrary(“testlib”);
}
}

Step 2: Compile wrapper class.
javac TestLibWrapper.java

Step 3: Run javah to create C header and stub file.
javah TestLibWrapper

Step 4…


Leave a Reply

%d bloggers like this: