I've written a test extension (Foo), the full source of which is contained within the readmore tags below my sig. It's a valid source distro - in that it can be built with 'perl Makefile.PL', 'make test' and 'make install'.
It's a bare-bones and useless extension that contains just one XSub named 'foo()'. When I build Foo, I note that the Foo.dll (shared object) that is built does not export 'foo()'. What do I need to do in order that Foo.dll *does* export 'foo()'.
## Foo.pm ##
package Foo;
use strict;
require Exporter;
*import = \&Exporter::import;
require DynaLoader;
$Foo::VERSION = '0.01';
DynaLoader::bootstrap Foo $Foo::VERSION;
@Foo::EXPORT = qw(foo);
@Foo::EXPORT_OK = ();
sub dl_load_flags {0} # Prevent DynaLoader from complaining and croaki
+ng
1;
__END__
## Makefile.PL ##
use ExtUtils::MakeMaker;
my %options = %{
{
'TYPEMAPS' => [
'C:\\perl510_M\\5.10.0\\lib\\ExtUtils\\typemap'
],
'NAME' => 'Foo',
'INC' => '-IC:/temp/Foo_build',
'VERSION' => '0.01'
}
};
WriteMakefile(%options);
# Remove the Makefile dependency. Causes problems on a few systems.
sub MY::makefile { '' }
__END__
## test.pl ##
use Foo;
$x = 17;
$y = 31;
$z = foo($x, $y);
if($z == 48){print "ok 1\n"}
else {print "not ok 1 $z\n"}
__END
// Foo.xs //
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
int foo(int x, int y) {
return x + y;
}
MODULE = Foo PACKAGE = Foo
PROTOTYPES: DISABLE
int
foo (x, y)
int x
int y