Works for me...

Here's the complete output of the build script that I used, so you can compare what's different in your case  (some whitespace added for clarity):

$ ./build-factorial.sh ========== ./build-factorial.sh ========== #!/bin/sh for file in $0 factorial.h factorial.c 837069.pl ; do echo ========== $file ========== cat $file echo done echo ======================================== rm -rf ./Book-Factorial PERLBIN=/usr/local/perl/5.10.1/bin set -x # create extension $PERLBIN/h2xs -n Book::Factorial -Ax factorial.h cp factorial.[hc] Book-Factorial cd Book-Factorial # edit Makefile.PL perl -i -pe 's/# (OBJECT)/$1/' Makefile.PL # build $PERLBIN/perl Makefile.PL make test # check ../837069.pl ========== factorial.h ========== double factorial_recursive_c(int x); double factorial_iterative_c(int x); ========== factorial.c ========== double factorial_recursive_c(int x) { if (x < 2) return 1; return x * factorial_recursive_c(x - 1); } double factorial_iterative_c(int x) { int i; double result = 1; for (i = 2; i <= x; i++) result *= i; return result; } ========== 837069.pl ========== #!/usr/local/perl/5.10.1/bin/perl -l use strict; use warnings; use lib qw(./blib/lib ./blib/arch); # just to avoid the need for inst +allation use Book::Factorial; my $result = Book::Factorial::factorial_iterative_c(5); print $result; ======================================== + /usr/local/perl/5.10.1/bin/h2xs -n Book::Factorial -Ax 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 + cp factorial.c factorial.h Book-Factorial + cd Book-Factorial + perl -i -pe 's/# (OBJECT)/$1/' Makefile.PL + /usr/local/perl/5.10.1/bin/perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Book::Factorial + make test cp lib/Book/Factorial.pm blib/lib/Book/Factorial.pm /usr/local/perl/5.10.1/bin/perl /usr/local/perl/5.10.1/lib/5.10.1/ExtU +tils/xsubpp -typemap /usr/local/perl/5.10.1/lib/5.10.1/ExtUtils/type +map Factorial.xs > Factorial.xsc && mv Factorial.xsc Factorial.c Please specify prototyping behavior for Factorial.xs (see perlxs manua +l) /usr/local/bin/gcc -c -I. -fno-strict-aliasing -pipe -I/usr/local/in +clude -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0. +01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/local/perl/5.10.1/lib/5.10.1 +/x86_64-linux/CORE" Factorial.c /usr/local/bin/gcc -c -I. -fno-strict-aliasing -pipe -I/usr/local/in +clude -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0. +01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/local/perl/5.10.1/lib/5.10.1 +/x86_64-linux/CORE" factorial.c Running Mkbootstrap for Book::Factorial () chmod 644 Factorial.bs rm -f blib/arch/auto/Book/Factorial/Factorial.so /usr/local/bin/gcc -shared -O2 -L/usr/local/lib Factorial.o factoria +l.o -o blib/arch/auto/Book/Factorial/Factorial.so \ \ chmod 755 blib/arch/auto/Book/Factorial/Factorial.so cp Factorial.bs blib/arch/auto/Book/Factorial/Factorial.bs chmod 644 blib/arch/auto/Book/Factorial/Factorial.bs PERL_DL_NONLAZY=1 /usr/local/perl/5.10.1/bin/perl "-MExtUtils::Command +::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Book-Factorial.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.02 cusr + 0.00 csys = 0.04 CPU) Result: PASS + ../837069.pl 120

In reply to Re: own perl module based on c library by almut
in thread own perl module based on c library by gants

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.