I'm having issues passing in an appropriate Java data type for the fetchByType C function's length parameter from my Java implementation (both below). On the C side, the *length parameter is a pointer to a length variable (output) to indicate the size of the data to be returned from the fetchByType C function. I've tried to use the SWIG %apply int32_t { int32_t * } and pass an int initialized at 0 from my Java implementation but that fails. I've also tried passing in a SWIGTYPE_p_int as shown below, but that also doesn't work. I don't have an exception unfortunately as this just crashes.
C Function:
void * fetchByType(struct row_t *result_row, type_t attribute, int32_t *length);
Generated Java from SWIG:
public static String fetchByType(SWIGTYPE_p_result_row_t result_row, type_t attribute, SWIGTYPE_p_int length)
Java Implementation:
SWIGTYPE_p_int length = new SWIGTYPE_p_int();
fetchByType(result_row, attribute, length)