Try adding the ld option -export-all-symbols

As regards my simplistic test case where I have Foo, Bar, and FooBar modules (and where FooBar needs to link to Foo.dll and Bar.dll), both Foo.dll and Bar.dll already export the symbols ('foo' and 'bar', respectively) that FooBar needs to link to.

Having installed Foo and Bar into C:/temp/perl, I can try to build FooBar in the following way:

1)Run 'perl Makefile.PL';
2) Open the generated Makefile and, to the LDLOADLIBS entry, append -LC:/temp/perl/lib/auto/Bar -lBar -LC:/temp/perl/lib/auto/Foo -lFoo;

Running dmake then 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, 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+0x2b): undefined reference to `bar' 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+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 +'
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 :-)

(This goes back to this thread - where, as you probably recall, you provided excellent help.)

Hidden in readmore tags, below my sig, is the source to all three (Foo, Bar and FooBar) extensions ... for any who feel driven to test things out. It amazes me that Gtk2 resorts to this sort of thing ... I'm sure there are reasons for doing that ... as to whether they are *good* reasons ....

Cheers,
Rob
=== 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

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.