I am building a module which connects to a camera, takes a picture, and reads the data into a piddle. All of this takes place in an Inline::C command. Using the procedure in the PDL documentation I can create a pdl *
and return it. However the camera could fail to take a picture in which case I would like to return 0
as per the usual covention my $pic_pdl = $Camera->TakePicture or die "Failed to take image"
. This seems to mean that I will need to use the Inline_Stack_Push
mechanism but I am not sure how to properly convert the pdl *
into an SV*
. Also I would like to, if possible, set $!
with the error code too. Can this be done in Inline?
Perl Inline::C return pdl or 0 on failure
285 views Asked by Joel Berger At
1
The
pdl*
is converted to an SV by code found in the typemap.If I read that right, you should be able to do something like:
As for
$!
, it's simply an interface to C'serrno
. Simply seterrno
.