On Mon, Feb 21, 2005 at 03:23:55PM -0500 [EMAIL PROTECTED] wrote:
> Hi Tassilo,
> 
> I've tried your first example and this doesn't seem to work
> 
> ------------------
> void
> getprocs()
>         PPCODE:
>                 HV *hv = newHV();
> 
>                 hv_store(hv, "pi_pid", 6, newSViv(123456), 0);
>                 XPUSHs(sv_2mortal(newSVrv((SV*)hv)));
> ------------------
> 
> returned me: $VAR1 = undef;
> 
> would it be possible to send me a little working example?

Yes, sorry. The correct function to use is actually newRV_(inc|noinc):

    XPUShs(sv_2mortal(newRV_noinc((SV*)hv)));

The _noinc version will leave the refcount of 'hv' untouched which is
often what you want in a situation like this. Sometimes however you want
to increase it in which case you will need 'newRV_inc'.

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);

Reply via email to