just read perldoc perlcall.  Looks like my function will now look like ....

int pushcompout (char * nm, char * val) {
   dSP ;
   int retval = 0;
   ENTER ;
   SAVETMPS;
   PUSHMARK(SP) ;
   if (strlen(nm) > 0 && strlen(val) > 0) {
      XPUSHs(sv_2mortal(newSVpv(nm, 0)));
      XPUSHs(sv_2mortal(newSVpv(val, 0)));
      retval += 2;
   }
   PUTBACK ;
   FREETMPS ;
   LEAVE ;
   return retval;
}

thanks.

----- Original Message ----- 
From: "Fletch" <[EMAIL PROTECTED]>
To: "Erick Nelson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, August 02, 2001 9:56 PM
Subject: Re: ACE.xs:37: `sp' undeclared (first use in this function)


> >>>>> "Erick" == Erick Nelson <[EMAIL PROTECTED]> writes:
> 
> [...]
> 
>     Erick> Line 37 is the first XPUSHs line.  Why won't this compile?
>     Erick> What is 'sp'?  If I cannot put this function where I placed
>     Erick> to where can I put it or how can I accomplish putting this
>     Erick> code into a function so I dont have to repeat these
>     Erick> statements over 30 times?
> 
>         sp is perl's stack pointer variable.  Inside an XSUB, the XS
> preprocessor will stick the correct magic to declare it for you.
> Outside of an XS, you'll need to to include the declaration yourself.
> Check out `perldoc perlcall' for examples of how to manipulate perl's
> stack from plain C (as opposed to from an XSUB).
> 
> 
> -- 
> Fletch                | "If you find my answers frightening,       __`'/|
> [EMAIL PROTECTED]   |  Vincent, you should cease askin'          \ o.O'
> 770 933-0600 x211(w)  |  scary questions." -- Jules                =(___)=
>                       |                                               U

Reply via email to