문제

I'm using the SWIG library to let a Java (Android) app call C functions.

I need to have some of my C functions return variable-sized arrays back to Java. How can I do this?

I've considered converting a long long * to a jlongarray, but I don't know how to pass the jlongarray back to Java with SWIG.

Does anyone know the best way to pass a variable-sized array from C to Java with SWIG (or any way at all)?

도움이 되었습니까?

해결책

I tried to make a custom typemap in SWIG, but I got segfaults when I did that.

I eventually solved the problem by writing a new function in straight JNI that puts the array elements into a jlongArray, rather than letting SWIG write a wrapper function for it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top