<[EMAIL PROTECTED]> writes:
>Hi all,
>
>I am trying to get acquainted with Perl-XS and couldn't find and answer
>to the following questions. I would appreciate some help.
>
>Since I am mainly interested in interfacing to C++ I have come across
>the typemap entry O_OBJECT in the PERLXS manpage as well as in the
>CookbookA
>There in the input section one reads
>if ( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
>
>according to Perl Guts sv_isobject checks for a blessed reference,
>so why is there the second check?
The second check is checking that the object is based on
a 'magical' PV (Pointer Value) - though without looking
at the details it is not clear why this matters.
Perhaps typemap is using '~' magic to associate C++ pointer
with the perl object?
>
>In the standard typemap there is a T_PTROBJ type.
>At first glance this looks like a better replacement for O_OBJECT. Is
>that true?
The handing of pointers in the standard typemap has always been patchy,
and has been known to vary wildly between perl releases.
I nearly always provide my own typemap so I know what is going on.
>
>A recent version of xsubpp generates
>dXSTARG;
>^^^^^^^
>sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
> ^^^^^^^^^ ^^^^^^^^
>
>I haven't found these in Perl Guts. Are they very recent?
Very, very recent.
--
Nick Ing-Simmons