I had taken a look at the ExtUtils::Mksymlists documentation, but didn't look at anything other than the DL_FUNCS docs. A bit further down, one finds FUNCLIST which seems to do exactly as I've asked. (It turns out that FUNCLIST is also documented in the ExtUtils::MakeMaker documentation.) The appropriate Makefile.PL looks like:
use ExtUtils::MakeMaker;
my %options = %{
{
'TYPEMAPS' => [
'C:\\perl510_M\\5.10.0\\lib\\ExtUtils\\typemap'
],
'NAME' => 'Foo',
'INC' => '-IC:/temp/Foo_build',
'FUNCLIST' => ['boot_Foo', 'foo'],
'VERSION' => '0.01'
}
};
WriteMakefile(%options);
# Remove the Makefile dependency. Causes problems on a few systems.
sub MY::makefile { '' }
Foo.dll then exports _boot_Foo, _foo, boot_Foo and _foo ... which is exactly what I'm after.
I'm kinda surprised that MinGW et al haven't added an specific extension to deal with this
Actually, __declspec(dllexport) probably works fine. I had made the mistake of coding it as
int __declspec(dllexport) foo(int x, int y)
whereas I think I needed to code it as
__declspec(dllexport) int foo(int x, int y)
Certainly the latter rendition creates a dll that exports foo(). But it exports it as XS_Foo_foo - which is not quite what I want.
Thanks muchly for the excellent help, BrowserUk.
Cheers, Rob |