home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


8.44 DynaLoader

The standard Perl interface to the dynamic linking mechanisms available on many platforms.

8.44.1 Using DynaLoader

Use 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.44.2 Extending to New Architectures

If you want to extend DynaLoader to a new architecture, you need to know about its internal interface. The variables it uses are:

$dl_debug

Enables internal debugging messages on the Perl side of the DynaLoader; by default, is set to $ENV{'PERL_DL_DEBUG'} if that is defined. A similar debugging variable is added to the C code (see dlutils.c ) and enabled if Perl was built with the -DDEBUGGING flag, or it can be set via the PERL_DL_DEBUG environment variable. Set to 1 for minimal information or higher for more detail.

@dl_library_path

Default list of directories to search for libraries; initialized to hold the list of directories in $Config{'libpth'} . Should also be initialized with other directories that can be determined from the environment at runtime.

@dl_resolve_using

List of additional libraries or other shared objects for resolving undefined symbols. Required only on platforms without automatic handling for dependent libraries.

@dl_require_symbols

List of one or more symbol names in the library/object file to be dynamically loaded. Only required on some platforms.

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.


Previous: 8.43 DirHandle Perl in a Nutshell Next: 8.45 English
8.43 DirHandle Book Index 8.45 English

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.