If, in step 2) I instead reverse the order and append -LC:/temp/perl/lib/auto/Foo -lFoo -LC:/temp/perl/lib/auto/Bar -lBar to the LDLOADLIBS entry in the generated Makefile, then dmake terminates with:FooBar.o:FooBar.c:(.text+0x1d): undefined reference to `foo' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\FooBar\FooBar.dll +'
If I don't do *anything* to the generated Makefile, dmake terminates with:FooBar.o:FooBar.c:(.text+0x2b): undefined reference to `bar' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\FooBar\FooBar.dll +'
I suspect that your suggestion of adding -export-all-symbols relates to the situation where Foo.dll and Bar.dll don't already export their symbols. In my case, both Foo.dll and Bar.dll already export their symbols, so I don't see that -export-all-symbols has anything to offer. (I know I don't have to ask you to correct me if I've missed the point :-)FooBar.o:FooBar.c:(.text+0x1d): undefined reference to `foo' FooBar.o:FooBar.c:(.text+0x2b): undefined reference to `bar' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\FooBar\FooBar.dll +'
=== The Bar Extension === -- Bar.pm -- package Bar; use strict; require Exporter; *import = \&Exporter::import; require DynaLoader; $Bar::VERSION = '0.01'; DynaLoader::bootstrap Bar $Bar::VERSION; @Bar::EXPORT = ('bar'); @Bar::EXPORT_OK = (); sub dl_load_flags {0} # Prevent DynaLoader from complaining and croaki +ng 1; -- Bar.xs -- #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int bar(int x, int y) { return x * y; } MODULE = Bar PACKAGE = Bar PROTOTYPES: DISABLE int bar (x, y) int x int y -- Makefile.PL -- use ExtUtils::MakeMaker; my %options = ( 'NAME' => 'Bar', 'FUNCLIST' => ['boot_Bar', 'bar'], 'VERSION' => '0.01' ); WriteMakefile(%options); # Remove the Makefile dependency. Causes problems on a few systems. sub MY::makefile { '' } -- test.pl -- use Bar; $y = 10; $x = 5; $z = bar($x, $y); if($z == 50){print "ok 1\n"} else {print "not ok 1 $z\n"} === The Foo Extension === -- Foo.pm -- package Foo; use strict; require Exporter; *import = \&Exporter::import; require DynaLoader; $Foo::VERSION = '0.01'; DynaLoader::bootstrap Foo $Foo::VERSION; @Foo::EXPORT = ('foo'); @Foo::EXPORT_OK = (); sub dl_load_flags {0} # Prevent DynaLoader from complaining and croaki +ng 1; -- 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 -- Makefile.PL -- use ExtUtils::MakeMaker; my %options = ( 'NAME' => 'Foo', 'FUNCLIST' => ['boot_Foo', 'foo'], 'VERSION' => '0.01' ); WriteMakefile(%options); # Remove the Makefile dependency. Causes problems on a few systems. sub MY::makefile { '' } -- 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"} === The FooBar Extension === -- FooBar.pm -- package FooBar; use strict; use lib 'C:/temp/perl/lib'; use Foo; use Bar; require Exporter; *import = \&Exporter::import; require DynaLoader; $FooBar::VERSION = '0.01'; DynaLoader::bootstrap FooBar $FooBar::VERSION; @FooBar::EXPORT = (); @FooBar::EXPORT_OK = (); sub dl_load_flags {0} # Prevent DynaLoader from complaining and croaki +ng 1; -- FooBar.xs -- #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int foobar(int x, int y) { return foo(x,y) + bar(x,y); } MODULE = FooBar PACKAGE = FooBar PROTOTYPES: DISABLE int foobar (x, y) int x int y -- Makefile.PL -- use ExtUtils::MakeMaker; my %options = ( 'NAME' => 'FooBar', 'VERSION' => '0.01' ); WriteMakefile(%options); # Remove the Makefile dependency. Causes problems on a few systems. sub MY::makefile { '' } -- test.pl -- use FooBar; $x = 5; $y = 22; $z = FooBar::foobar($x, $y); if($z == 137) {print "ok 1\n"} else {print "not ok 1 $z\n"}
In reply to Re^4: RFC: Setting up a minGW compiling envronment for Perl 5.10
by syphilis
in thread RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |