[snip] >>However, it seems that I've taken my eye off the ball with all these >>compilation problems and concerns over memory leaks: the >>PUSHi()/PUSHp() version of the XSUB above doesn't actually work properly! >> >>Instead of returning (42, "Forty-two"), it returns ("Forty-two", >>"Forty-two"). In general, if I use PUSHi() or PUSHp() to push N things >>onto the stack and then XSRETURN(N) then I seem to get N copies of the >>last return value that I pushed. > >Only one TARG SV for the op. If you look at macros in pp.h >you will see > >PUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); PUSHTARG; } STMT_END > >So it sets the one SV to the value, and then pushes the one SV. > >So it seems that PUSHi() et. al. are not suitable for list returns. >
Could you clarify that a bit? Why not?