develooper Front page | perl.perl5.porters | Postings from January 2016

Assistance needed with XS code

Thread Next
From:
John Peacock
Date:
January 1, 2016 15:06
Subject:
Assistance needed with XS code
Message ID:
568695F7.1060503@havurah-software.org
I'm working my way through the backlog of RT tickets for version.pm in 
preparation to release 0.9913 with the Lyon Compromise.

I've run into something I can't figure out:

   https://rt.cpan.org/Ticket/Display.html?id=107459

I cannot figure out how to create the version object in XS in such a way 
that it is an RV of an HV.  The way I am currently doing it is to create 
an RV then upgrade that to an HV,

     hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
     (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */

but this apparently doesn't DTRT for the object's stash.  I tried to use 
newHV directly, then upgrade that to an RV, but that throws cores every 
time.

If someone can suggest how I can do this properly, I'm all ears.

John

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About