summaryrefslogtreecommitdiff
path: root/ext/DynaLoader/DynaLoader_pm.PL
diff options
context:
space:
mode:
authorDoug MacEachern <dougm@covalent.net>2002-05-30 20:05:47 +0000
committerDoug MacEachern <dougm@covalent.net>2002-05-30 20:05:47 +0000
commit588cafc81b146d309df37bae231b533d51bccb74 (patch)
tree43935ddded44416750d0942cb751cba18840f9aa /ext/DynaLoader/DynaLoader_pm.PL
parentd4dccd5f0004873a20dd5dc039f9e61e7ef68bbb (diff)
downloadperl-588cafc81b146d309df37bae231b533d51bccb74.tar.gz
prevent attempts to load extension libraries more than once on darwin.
avoiding fatal errors in the form of: "multiple definitions of symbol _XS_foo" p4raw-id: //depot/perl@16903
Diffstat (limited to 'ext/DynaLoader/DynaLoader_pm.PL')
-rw-r--r--ext/DynaLoader/DynaLoader_pm.PL15
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL
index 9fdaf70be8..d6e6dc6b65 100644
--- a/ext/DynaLoader/DynaLoader_pm.PL
+++ b/ext/DynaLoader/DynaLoader_pm.PL
@@ -283,6 +283,14 @@ sub bootstrap {
warn "$bs: $@\n" if $@;
}
+ my $boot_symbol_ref;
+
+ if ($^O eq 'darwin') {
+ if ($boot_symbol_ref = dl_find_symbol(0, $bootname)) {
+ goto boot; #extension library has already been loaded, e.g. darwin
+ }
+ }
+
# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
@@ -301,13 +309,14 @@ sub bootstrap {
Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
}
- my $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
+ $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
croak("Can't find '$bootname' symbol in $file\n");
- my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
-
push(@dl_modules, $module); # record loaded module
+ boot:
+ my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
+
# See comment block above
&$xs(@args);
}