Hi Rob,
Thanks for your help!
I want to send a reference to array (test) from perl :
my @test;
my $reftest = \@test;
add_nir(1,4,\$reftest);
and fill that array inside a cpp funcion (add_nir(..)).
I followed your previous reply and I am using the perl guts
:
int add_nir(int x, int y, AV** perlList )
{
*perlList = newAV();
SV* perlItem=newSViv(2);
av_push(*perlList, perlItem);
...
}
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 )
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 function
newAV()
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 level
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);
...}
and the second level redirection couldn't be used :
when running a test using my module I got the following error:
Can't locate auto/PM_wed/add_nir.al in @INC .....
What should I do ?
Thanks, Nir |