and fill that array inside a cpp funcion (add_nir(..)). I followed your previous reply and I am using the perl guts :my @test; my $reftest = \@test; add_nir(1,4,\$reftest);
I am using second layer references (pointer to pointer) because first level reference (see the difference in <AV* perlList> at the function declarations ):int add_nir(int x, int y, AV** perlList ) { *perlList = newAV(); SV* perlItem=newSViv(2); av_push(*perlList, perlItem); ... }
didn't work. (after I filled the array in add_nir and left the function to it's caller, the array was empty - does the functionint add_nir(int x, int y, AV* perlList )
allocates on the stack or the heap?) As i said the first level reference compiled but the array was empty on returning to the perl :first redirection levelnewAV()
and the second level redirection couldn't be used : when running a test using my module I got the following error:my @test; add_nir(1,4,\@test); int add_nir(int x, int y, AV* perlList ) { perlList = newAV(); SV* perlItem=newSViv(2); av_push(perlList, perlItem); ...}
What should I do ? Thanks, NirCan't locate auto/PM_wed/add_nir.al in @INC .....
In reply to Re^6: Inline CPP
by nirf1
in thread Inline CPP
by nirf1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |