At 04:21 PM 10/23/2001 -0700, Jennifer Cranfill wrote:
>I am trying to write a Perl to C extension that passes variable-length
>parameter lists from Perl to C. While I know how to pass variable-length
>argument lists from Perl to my XS code, I am not sure how to then call a C
>function with this variable number of arguments.

You can't--you have to fake it. Something like:

   switch (items) {
         case 1:  foo(1); break;
         case 2:  foo(1, 2); break;
         case 3:  foo(1,2,3); break;
   }

and so on. Wildly nasty, mind, but it works as well as you're going to get 
in C without dropping down to assembly and building the argument list by hand.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to