in reply to Re: [XS on Win32] How to have the extension's dll export its symbols.
in thread [XS on Win32] How to have the extension's dll export its symbols.

As regards point 1 :
The def file is auto-generated during the 'make' process - which is 'dmake', in my case. How does one influence the contents of the def file that is created by that automated procedure ?

As regards point 2 :
I changed Foo.xs so that it now has:
#include "EXTERN.h" #include "perl.h" #include "XSUB.h" int __declspec(dllexport) foo(int x, int y) { return x + y; } MODULE = Foo PACKAGE = Foo PROTOTYPES: DISABLE int foo (x, y) int x int y
But, according to dumpbin /exports, 'Foo.dll' still exports only '_boot_Foo' and 'boot_Foo'.

I'm using the MinGW compiler - don't know if that has any bearing on the matter ... apologies if I'm being dense.

Cheers,
Rob

Replies are listed 'Best First'.
Re^3: [XS on Win32] How to have the extension's dll export its symbols.
by BrowserUk (Patriarch) on Mar 05, 2008 at 12:59 UTC
    I'm using the MinGW compiler ...

    If you follow the link I belatedly added to my response you'll see that dllexport is an MS specific extension. Presumably the __declspec() bit is a part of some standard otherwise you'd be getting an error.

    Whether MinGW supports a similar extension I don't know. They can build .sos an .dlls so must have encountered similar problems.

    1. How does one influence the contents of the def file that is created by that automated procedure ?

      I looked that up a while ago. There is mention in the pod for E::MM of a coniguration attribute DL_FUNCS which seems to be something to do with it.

    2. I changed Foo.xs so that it now has:

      See above:)


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      There is mention in the pod for E::MM of a coniguration attribute DL_FUNCS which seems to be something to do with it

      Yes - that's probberly the way to go. I tried inserting 'DL_FUNCS' => {'Foo' => ['boot_Foo', 'foo']}, into WriteMakefile() of the Makefile.PL. Having done that, dumpbin reports that Foo.dll exports XS_Foo_foo, _XS_Foo_foo, boot_Foo and _boot_Foo. I'm wanting to see that foo, _foo, boot_Foo, and _boot_Foo are exported. (I've just got to work out how to remove that "XS_Foo_" prefix.)

      Cheers,
      Rob

        Take a look at ExtUtils::Mksymlists and it's FUNCLIST argument and associated discussion. It provides for adding exports unadorned by the BOOT_ stuff. Note: I've never tried to use it. I just followed the link from the earlier page.

        I'm kinda surprised that MinGW et al haven't added an specific extension to deal with this. Maintain export definitions by hand is a bloody nightmare. (Thought easier than with executable Config files :)


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.