8.61. DynaLoaderThe standard Perl interface to the dynamic linking mechanisms available on many platforms. 8.61.1. Using DynaLoaderUse DynaLoader like this: package Module; require DynaLoader; @ISA = qw(... DynaLoader ...); bootstrap Module; The bootstrap method calls your module's bootstrap routine directly if the module is statically linked into Perl. Otherwise, the module inherits the bootstrap method from DynaLoader, which loads in your module and calls its bootstrap method. 8.61.2. Extending to New ArchitecturesIf you want to extend DynaLoader to a new architecture, you need to know about its internal interface. The variables it uses are:
Of the following subroutines, bootstrap and dl_findfile are standard across all platforms and are defined in DynaLoader.pm. The others are defined in the .xs file that supplies the implementation for the platform.
bootstrap (modulename) Normal entry point for automatic dynamic loading in Perl.
dl_error Gets error message text from the last failed DynaLoader function: $message = dl_error( );
dl_expandspec (spec) Used for systems that require special filename handling to deal with symbolic names for files. spec specifies the filenames that need the special handling.
dl_findfile (names) Determines the full paths to one or more loadable files, given their generic names and optionally one or more directories. Searches directories in @dl_library_path by default and returns an empty list if no files are found.
dl_find_symbol (libref, symbol) Looks in libref for the address of symbol symbol. Returns the address, or undef if not found.
dl_install_xsub (perl_name, symref[, filename]) Creates a new Perl external subroutine. Takes the following arguments:
dl_load_file (filename) Dynamically loads filename, which must be the path to a shared object or library; returns undef on error.
dl_undef_symbols Returns list of symbol names that remain undefined after dl_load_file, or ( ) if the names are unknown. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|