I'm trying to call the following c++
function:
uint32_t FunctionName(uint32_t *arg1,uint32_t *arg2,uint32_t *arg3)
but I cannot find a way to map this in Javacpp
.
How do I pass the pointer reference to the function, and how do I retrieve the changed values from the passed pointers afterwards?
Something like this should work just fine:
import com.googlecode.javacpp.*;
import com.googlecode.javacpp.annotation.*;
@Platform(include="lib.h", link="lib")
public class Lib {
static { Loader.load(); }
public static native int FunctionName(@Cast("uint32_t*") int[] arg1,
@Cast("uint32_t*") int[] arg2,
@Cast("uint32_t*") int[] arg3);
public static void main(String[] args) {
int[] arg1 = new int[SIZE1], arg2 = new int[SIZE2], arg3 = new int[SIZE3];
int ret = FunctionName(arg1, arg2, arg3);
// do what you need to do with the arguments
}
}