SV* sv = newSV_type(SVt_PV); SvPV_set(sv, (char*)u_ptr); SvLEN_set(sv, 0); /* So Perl won't free it. */ SvCUR_set(sv, sizeof(Uint32)); SvPOK_on(sv);