Moreover when you do:
/* Something Perl shouldn't free */ static char s[4] = "\x11\x11\x11\x11"; SV* fetch() { SV* sv = newSV_type(SVt_PV); SvPV_set(sv, s); SvPOK_on(sv); SvLEN_set(sv, 0); SvCUR_set(sv, 4); return newRV_noinc(sv); }
The Devel::Peek::Dump shows:
SV = IV(0x8add89c) at 0x8add8a0 REFCNT = 1 FLAGS = (PADMY,ROK) RV = 0x8abf520 SV = PV(0x8abc700) at 0x8abf520 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0xb7d0e06c "\21\21\21\21" CUR = 4 LEN = 0
However for my set of
SV * sv = newSV_type(SVt_PV); SvPV_set(sv, surface->pixels); SvPOK_on(sv); SvLEN_set(sv, 0); SvCUR_set(sv, surface->format->BytesPerPixel * surface->w * +surface->h); RETVAL = newRV_noinc(sv);
The surface Devel::Peek::Dump has different types:
SV = RV(0x142b330) at 0x142b324 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x3e90fc SV = PV(0x1287a9c) at 0x3e90fc REFCNT = 1 FLAGS = (POK,pPOK) PV = 0xcea408 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" CUR = 16 LEN = 0
Why is the type a RV and not IV?
In reply to Re^2: Writing to Pointer Values (PV) in XS
by kthakore
in thread Writing to Pointer Values (PV) in XS
by kthakore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |