|
From: Jay S <mys...@ya...> - 2011-02-13 03:07:12
|
Here’s an example.1. Getting the len parameter doesn’t seem to be a problem - comes out okay.2. Could someoneplease shine some light on what is the right way of getting the **arrout parameter back to perl? This is how I’m sending it in and it appears to work with c..Just don’t know how to get it out.3. I have a typemap like this: TYPEMAP:%array_functions(int,intArray);%pointer_functions(int, intp); %typemap(in) int ** (int* intpref) { SV* tempsv; if (!SvROK($input)) croak("expected a reference\n"); tempsv = SvRV($input); intpref = SvIV (tempsv); $1 = &intpref;}%typemap(out) (int **arrayin, int *OUTPUT) { } PERL$a2 = example::new_intp();(@retarr, @retarr2)= example::return_array_int(\\$a1); C void return_array_int(int **arrout, int *len){ int i=0; *arrout = (int *)malloc(4 * sizeof(int)); *len=4; for(i=0;i<4;i++) {
*(*arrout+i)=7-i; }}
|