I'm writing an extension to perl to call FirstLogic's Postalsoft ACE
library.
In my package, I have a method that returns a list of key/value pairs.
I do this so often that I wanted to write a c function to add them to
the stack so
I wrote the follow......

/* push a component name and value out onto the return stack */

int pushcompout(char *, char *);

int pushcompout (char * name, char * value) {
        int retval = 0;
        if (strlen(name) > 0 && strlen(value) > 0) {
                XPUSHs(sv_2mortal(newSVpv(name, 0)));
                XPUSHs(sv_2mortal(newSVpv(value, 0)));
                retval += 2;
        }
        return retval;
}

...I put this code above the
MODULE = ACE            PACKAGE = ACE
so it would not be treated as an 'xs' function and precompiled with all
the
usuall xs stuff.
The problem is that it will not compile. I get the following error...

ACE.xs: In function `pushcompout':
ACE.xs:37: `sp' undeclared (first use in this function)
ACE.xs:37: (Each undeclared identifier is reported only once
ACE.xs:37: for each function it appears in.)

Line 37 is the first XPUSHs line.  Why won't  this compile? What is
'sp'?
If I cannot put this function where I placed to where can I put it or
how can
I accomplish putting this code into a function so I dont have to repeat
these
statements over 30 times?

Reply via email to