2

I want to parse a byte array in native C and use the results packed in structs in Java. For wrapping the C code in Java I'm using SWIG and got everything setup in my build process.

My problem is that I can't figure out how structs with dynamic arrays can be wrapped successfully:

struct myData
{ 
    float floatValue;
    char boolValue;
    int *intList;
    int intListLength;
};

The wrapper generated with SWIG has a function getIntList that returns an object of type SWIGTYPE_p_int instead of int[]. Unfortunately I couldn't get my head around typemap, carrays.i, etc., nor could find any help on my specific issue. Is there a way to achieve that I can get int[]? If not, how can I use SWIGTYPE_p_int to access data in the array?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.