1 # Generated from XSLoader.pm.PL (resolved %Config::Config value)
5 # And Gandalf said: 'Many folk like to know beforehand what is to
6 # be set on the table; but those who have laboured to prepare the
7 # feast like to keep their secret; for wonder makes the words of
10 # (Quote from Tolkien sugested by Anno Siegel.)
12 # See pod text at end of file for documentation.
13 # See also ext/DynaLoader/README in source tree for other information.
15 # Tim.Bunce@ig.co.uk, August 1994
17 $VERSION = "0.01"; # avoid typo warning
19 # enable debug/trace messages from DynaLoader perl code
20 # $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
26 # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
27 # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
28 boot_DynaLoader
('DynaLoader') if defined(&boot_DynaLoader
) &&
34 # The bootstrap function cannot be autoloaded (without complications)
35 # so we define it here:
42 # work with static linking too
43 my $b = "$module\::bootstrap";
44 goto &$b if defined &$b;
46 goto retry
unless $module and defined &dl_load_file
;
48 my @modparts = split(/::/,$module);
49 my $modfname = $modparts[-1];
51 my $modpname = join('/',@modparts);
52 my $modlibname = (caller())[1];
54 $modlibname =~ s
,[\\/][^\\/]+$,, while $c--; # Q&D basename
55 my $file = "$modlibname/auto/$modpname/$modfname.$dl_dlext";
57 # print STDERR "XSLoader::load for $module ($file)\n" if $dl_debug;
60 $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
62 goto retry
if not -f
$file or -s
$bs;
64 my $bootname = "boot_$module";
65 $bootname =~ s/\W/_/g;
66 @dl_require_symbols = ($bootname);
68 # Many dynamic extension loading problems will appear to come from
69 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
70 # Often these errors are actually occurring in the initialisation
71 # C code of the extension XS file. Perl reports the error as being
72 # in this perl code simply because this was the last perl code
75 my $libref = dl_load_file
($file, 0) or do {
77 Carp
::croak
("Can't load '$file' for module $module: " . dl_error
());
79 push(@dl_librefs,$libref); # record loaded object
81 my @unresolved = dl_undef_symbols
();
84 Carp
::carp
("Undefined symbols present after loading $file: @unresolved\n");
87 my $boot_symbol_ref = dl_find_symbol
($libref, $bootname) or do {
89 Carp
::croak
("Can't find '$bootname' symbol in $file\n");
92 my $xs = dl_install_xsub
("${module}::bootstrap", $boot_symbol_ref, $file);
94 push(@dl_modules, $module); # record loaded module
96 # See comment block above
101 goto &DynaLoader
::bootstrap_inherit
;
108 XSLoader - Dynamically load C libraries into Perl code
115 XSLoader::load 'YourPackage', @args;
119 This module defines a standard I<simplified> interface to the dynamic
120 linking mechanisms available on many platforms. Its primary purpose is
121 to implement cheap automatic dynamic loading of Perl modules.
123 For more complicated interface see L<DynaLoader>.
127 Ilya Zakharevich: extraction from DynaLoader.