Alan Burlison <[EMAIL PROTECTED]> writes:
>Nick Ing-Simmons wrote:
>
>> ....
>> if (mystp = getmystructbyid(id)) {
>> pushret_mystruct(mystp);
>> return;
>> } else {
>> XSRETURN_EMPTY;
>> }
>
>This isn't quite right (well, actually it doesn't work :-) On examining
>the code generated by xsubpp, it does a SP -= items; at the very
>beginning of the generated code.
Ah, oops sorry I missed the PPCODE vs CODE issue.
(The machine-level programmer in me distrusts moving the stack back before
one is finished with it so for that reason I seldom use PPCODE.)
>This of course only updates the local
>copy of SP, so when the called routine does a dSP it gets the value of
>the SP before the subtraction. To fix it you simply need to PUTBACK;
>before the call to pushret_mystruct.
Yes.
>
>See, because of your help I now really *do* understand what is going on
>:-)
Excellent.
--
Nick Ing-Simmons