Looks like the problem is the -F option to h2xs. Not only is it useless here (which is why I dropped it), it's in fact the source of the problem, because it declares "factorial.h" to be a C preprocessor flag, so there remains no .h file to scan...
$ h2xs -n Book::Factorial -A -O -x -F factorial.h Defaulting to backwards compatibility with perl 5.10.1 If you intend this module to be compatible with earlier perl versions, + please specify a minimum perl version with the -b option. Writing Book-Factorial/ppport.h Scanning typemaps... Scanning /usr/local/perl/5.10.1/lib/5.10.1/ExtUtils/typemap Writing Book-Factorial/lib/Book/Factorial.pm Writing Book-Factorial/Factorial.xs Writing Book-Factorial/Makefile.PL Writing Book-Factorial/README Writing Book-Factorial/t/Book-Factorial.t Writing Book-Factorial/Changes Writing Book-Factorial/MANIFEST ---- $ h2xs -n Book::Factorial -A -O -x factorial.h Defaulting to backwards compatibility with perl 5.10.1 If you intend this module to be compatible with earlier perl versions, + please specify a minimum perl version with the -b option. Writing Book-Factorial/ppport.h Scanning typemaps... Scanning /usr/local/perl/5.10.1/lib/5.10.1/ExtUtils/typemap Scanning factorial.h for functions... # <--- !! Scanning factorial.h for typedefs... Writing Book-Factorial/lib/Book/Factorial.pm Writing Book-Factorial/Factorial.xs Writing Book-Factorial/Makefile.PL Writing Book-Factorial/README Writing Book-Factorial/t/Book-Factorial.t Writing Book-Factorial/Changes Writing Book-Factorial/MANIFEST
The latter variant produces the follwing correct Factorial.xs file:
#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include <factorial.h> MODULE = Book::Factorial PACKAGE = Book::Factorial double factorial_iterative_c(x) int x double factorial_recursive_c(x) int x
In reply to Re^2: own perl module based on c library
by almut
in thread own perl module based on c library
by gants
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |