Hi
I am new to XS programming and have been strugling to call an existing C
fucntion from PERL. I am using PERL 5.00503 on NT.
I am compiling the stuff as mentioned in example 4 of perlxstut. The
example, as it is, works fine. But if I try the same steps with my C code,
then it fails. The compilation is smooth, but when I run "nmake test", it
says that the fuction is undefined. I have tried putting the fucntion name
in EXPORT_OK as well as EXPORT, but that too doesnt work. Finally, I added
my functions to the files in example 4, but that resulted in the "foo"
function too getting undefined. Please help....
Regards
Hemant Joshi
For those who would like some details......
### mylib.h
#define TESTVAL 4
extern double foo(int, long, const char*);
extern char * newmeta (char * ) ;
######### toplevel makefile.pl
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'MyTest2',
'VERSION_FROM' => 'MyTest2.pm', # finds $VERSION
'LIBS' => [''], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
'INC' => '', # e.g., '-I/usr/include/other'
'MYEXTLIB' => 'mylib/libmylib$(LIB_EXT)',
);
sub MY::postamble {
'
$(MYEXTLIB): mylib/Makefile
cd mylib && $(MAKE) $(PASTHRU)
';
}
######## XS stuff that I added
double
foo(a,b,c)
int a
long b
const char * c
OUTPUT:
RETVAL
char *
newmeta(str)
char * str
OUTPUT:
RETVAL
######### typemap
const char * T_PV
char * T_PV