in reply to Auto-setting the OVERLOAD flag in an XS routine

I'm getting a little further; I changed it to use this:
HV* stash = SvSTASH(*el_iter); SV* el = newRV(*el_iter); if (Perl_hv_exists(stash, "OVERLOAD", 8)) SvAMAGIC_on(el); sv_2mortal(el);

Which mostly works, but I cannot figure out how to set the "fallback" setting of the returned RV (as in this node). The returned objects behave as if the package they were in specified fallback => 0

Update: This also doesn't work on sub-classes of overloaded objects, because those objects don't have OVERLOAD defined in their stash.