This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In makedef.pl, export boot_* for static modules only on Win32 and WinCE.
authorNicholas Clark <nick@ccl4.org>
Fri, 29 Jul 2011 11:37:42 +0000 (13:37 +0200)
committerNicholas Clark <nick@ccl4.org>
Mon, 1 Aug 2011 09:53:56 +0000 (11:53 +0200)
The code as-is will only be run on Win32 and WinCE, because currently the
code to populate $static_ext is only run on Win32 and WinCE. As-is this code
can't be run on all platforms, because currently *nix (ie AIX) links static
extensions into the perl executable, rather than into the shared perl
library. Hence boot_* functions for static extensions aren't in the shared
perl library, so it would be an error to attempt to export them from it.

makedef.pl

index 688a304..f84c009 100644 (file)
@@ -1255,11 +1255,23 @@ elsif ($PLATFORM eq 'netware') {
                 ));
 }
 
-# records of type boot_module for statically linked modules (except Dynaloader)
-$static_ext =~ s/\//__/g;
-$static_ext =~ s/\bDynaLoader\b//;
-try_symbols(map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext);
-try_symbols("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
+# When added this code was only run for Win32 and WinCE
+# Currently only Win32 links static extensions into the shared library.
+# The WinCE makefile doesn't appear to support static extensions, so this code
+# can't have any effect there.
+# The NetWare Makefile doesn't support static extensions (and hardcodes the
+# list of dynamic extensions, and the rules to build them)
+# For *nix (and presumably OS/2) with a shared libperl, Makefile.SH compiles
+# static extensions with -fPIC, but links them to perl, not libperl.so
+# The VMS build scripts don't yet implement static extensions at all.
+
+if ($PLATFORM =~ /^win(?:32|ce)$/) {
+    # records of type boot_module for statically linked modules (except Dynaloader)
+    $static_ext =~ s/\//__/g;
+    $static_ext =~ s/\bDynaLoader\b//;
+    try_symbols(map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext);
+    try_symbols("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
+}
 
 if ($PLATFORM eq 'os2') {
     my (%mapped, @missing);