I'm trying to do the following in a bit of XS code: CV *cv = ...; sv_setrv(get_sv("Some::Package::VAR", GV_ADD), (SV *)cv); this fails because there isn't an sv_setrv(). I vote it should be added. However, I'm struggling to find a sensible implementation for it. A hacked-up version that does work just fine is: static void sv_setrv(SV *sv, SV *rv) { SV *tmp = newRV_noinc(rv); sv_setsv(sv, tmp); SvREFCNT_dec(tmp); } but of course this is rather silly having to create and throw away that `tmp`. I've tried hunting around perl core for various bits to copypaste, but lots of tempting ideas end up containing macros that are #ifdef PERL_CORE so I can't see them from XS. Can anyone suggest something better? -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/Thread Next