in reply to Re^5: Inline CPP
in thread Inline CPP
Hi Rob,
Thanks for your help!
I want to send a reference to array (test) from perl :
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 .....
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Inline CPP
by syphilis (Archbishop) on Jun 03, 2008 at 02:29 UTC | |
by nirf1 (Novice) on Jun 03, 2008 at 07:32 UTC | |
by syphilis (Archbishop) on Jun 04, 2008 at 03:08 UTC |
In Section
Seekers of Perl Wisdom