>     PPCODE:
>         /* Grab the list of pointers */
>         meta_list = SwishMetaList( swish_handle, index_name );
> 
>         PUSHMARK(SP) ;
>         XPUSHs( (SV *)swish_handle );
>         XPUSHs( (SV *)meta_list );
>         XPUSHs( (SV *)"SWISH::API::MetaName");
>         PUTBACK ;           /* lets perl know how many parameters are here */
> 
>         call_pv("SWISH::API::push_meta_list", G_ARRAY );
>         SPAGAIN;
> 
> Do I need to check the return value of call_pv() and use that to set the
> stack size?  The perl stack is somewhat, no, mostly black magic to me.
> 
 
It was black magic to me(probably still a little), until I saw PUSHMARK
in your code and wondered what does that do?  So I found it in perlcall
docs and learned something new today. Thanks Bill, :-)  The perlcall doc
is very good, and from it I found, 

  3.   Although only a single value was expected to be returned from
       Adder, it is still good practice to check the return code from
       call_pv anyway.

       Expecting a single value is not quite the same as knowing that
       there will be one. If someone modified Adder to return a list and
       we didn't check for that possibility and take appropriate action
       the Perl stack would end up in an inconsistent state. That is
       something you really don't want to happen ever.

...so applying it to your question, I would say you want to check the 
   return value of call_pv and make sure you are getting the right num
   of values "pushed" on the stack.  According to the docs, the returned
   values will be pushed onto the stack for you, you don't need to set
   the stack size.  


                                    HTH,
                                       STH


Reply via email to