#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
int add_one(int i) {
return i + 1;
}
int add_two(int i) {
return i + 1;
}
MODULE = Test PACKAGE = Test
int
add_interface(i)
int i
INTERFACE:
add_one
add_two
####
cc -c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xO3 -xdepend -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -KPIC -I/usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE Test.c
"Test.c", line 34: syntax error before or at: cv
"Test.c", line 45: type specifier can not be used as array size expression qualifier
"Test.c", line 45: warning: no explicit type given
"Test.c", line 46: cannot recover from previous errors
cc: acomp failed for Test.c
*** Error code 2
make: Fatal error: Command failed for target `Test.o'
####
XS(XS_Test_add_interface)
{
dXSARGS;
dXSFUNCTION(int);
if (items != 1)
Perl_croak(aTHX_ "Usage: Test::add_interface(i)");
{
int i = (int)SvIV(ST(0));
int RETVAL;
dXSTARG;
XSFUNCTION = XSINTERFACE_FUNC(int,cv,XSANY.any_dptr);
RETVAL = XSFUNCTION(i);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}