Hi I am a new user of Inline. So could somebody
help me here?
I am trying to write a C subroutine with Inline. I
want to pass the reference of an array to the subroutine for calculation,
and work on the values in the array. The following is my code:
_____CODE START_____
use Inline C=>'DATA'
my @array = ( 1 .. 100);
print get_an_element([EMAIL PROTECTED]);
__DATA__
__C__
int get_an_element(SV* aref){
AV* array;
if (! SvROK(aref))
croak("aref is not a reference"); array = (AV*)SvRV(aref);
SV** v = av_fetch(array,8, 0); SV* u=SvRV(v);
return SvRV(u);
} ________END__________
However, the deferencing of v is not working. What
should I do to get the value of the AV*?
Thanks a lot,
Robbie |
- Get an array value Guohong Hu
- Re: Get an array value Peter Sinnott