Bill Moseley said:
> I don't know how many values will be pushed onto the stack, so I can't
> check.  There may be no returned values on the stack, as well.

then you need to do something like this:

   /* invoke perl sub */
   n = call_pv (name, G_ARRAY);

   /* refresh local copy of stack pointer */
   SPAGAIN;

   /* get any and all returned values off of the stack */
   while (n-- > 0) {
      SV * sv = POPs;  /* pop last value off of the stack */
      /* do whatever with that value */
   }

   /* commit stack changes */
   PUTBACK;



> What I was wondering about was my use of SPAGAIN -- as that resets my
> local copy of the stack pointer (or so I'm told by perlcall).  But, how
> do I know that the values pushed on the stack by the secondary subroutine
> get returned correctly to the calling Perl-space code?

what's the "secondary routine"?  the code you called with call_pv()?  in that
case they returned the values to your XS code, and you are now responsible for
doing something with them.  are you wanting simply to pass them straight back
to your caller?  or are you talking about using them in your xsub?



-- 
muppet <scott at asofyet dot org>

Reply via email to