我正在尝试调用以下c++
函数:
uint32_t FunctionName(uint32_t *arg1,uint32_t *arg2,uint32_t *arg3)
但我找不到将其映射到Javacpp
.
如何将指针引用传递给函数,之后如何从传递的指针中检索更改的值?
像这样的东西应该可以正常工作:
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
}
}