Hi Tassilo

thanx for the last mail. It's working as expected :)

Yannick Bergeron



                                                                           
             Tassilo von                                                   
             Parseval                                                      
             <tassilo.von.pars                                          To 
             [EMAIL PROTECTED]         Yannick Y                           
             de>                       Bergeron/Bromont/[EMAIL PROTECTED]       
   
             Sent by: ethan                                             cc 
             <tassilo.von.pars         perl-xs@perl.org                    
             [EMAIL PROTECTED]                                     Subject 
             de>                       Re: XPUSHs a HV                     
                                                                           
                                                                           
             2005-02-21 16:17                                              
                                                                           
                                                                           
                                                                           




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