Hi,
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()'.

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

In reply to [XS on Win32] How to have the extension's dll export its symbols. by syphilis

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.