Reinhard Pagitsch
2009-06-05 11:12:49 UTC
Hi,
I'm fairly new to the XS business. I have managed to get the skeleton up
(h2xs) and have also managed to write short functions that have ints as
arguments and return strings, but I'd like to pass a full Perl scalar
(my $cdb = pack('C*', 0x12, 0, 0, 0, 128, 0);) and retrieve the length
(6) and the bytes themselves in the C function and also return such a
scalar.
How do I do that?
Thanks,
Josef
Did you looked at the eval_* functions in perlapi.pod?I'm fairly new to the XS business. I have managed to get the skeleton up
(h2xs) and have also managed to write short functions that have ints as
arguments and return strings, but I'd like to pass a full Perl scalar
(my $cdb = pack('C*', 0x12, 0, 0, 0, 128, 0);) and retrieve the length
(6) and the bytes themselves in the C function and also return such a
scalar.
How do I do that?
Thanks,
Josef
eval_pv
Tells Perl to eval the given string and return an SV* result.
NOTE: the perl_ form of this function is deprecated.
SV* eval_pv(const char* p, I32 croak_on_error)
eval_sv
Tells Perl to eval the string in the SV.
NOTE: the perl_ form of this function is deprecated.
I32 eval_sv(SV* sv, I32 flags)
regards,
Reinhard