summaryrefslogtreecommitdiff
path: root/ext/DynaLoader
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafcol.lafayette.edu>1995-01-26 00:40:50 +0000
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1995-01-26 00:40:50 +0000
commit75f926282bd78abe2f394977be7dd4dc52cb21ba (patch)
treefd86369fb52a5fa00387d1ce65c7086f0ac41b94 /ext/DynaLoader
parent420218e7eb4fa5ceefe298e6d9121548b8d806d6 (diff)
downloadperl-75f926282bd78abe2f394977be7dd4dc52cb21ba.tar.gz
perl5.000 patch.0i: fix glaring mistakes in patches a-h
This patch does the following things: 1. Fix various bonehead errors I introduced in patches a-g. 2. Incorporate MakeMaker changes to bring it up to version 4.01 (mostly). 3. Stick in things I forgot in patches a-g (e.g. AIX). 4. Some minor additional cleanup in x2p/ for even pickier compilers. 5. More hints updates (hpux and next). 6. Include newest dl_hpux.xs. I didn't have time to 1. Fix the overlapping strcpy() in op.c 2. Restore h2xs to Larry's original design to process <>. 3. take out unnecessary "use Config" in installperl. 4. Add in vms patches. I forgot to [If I remembered what i forgot, I wouldn't have forgotten it. :] I deliberately decided *not* to 1. Touch pod/* 2. deal with overloading Specifically, here's what's included: Configure Regenerated to be sure it's up-to-date. Makefile.SH Build extension libraries right into lib/auto/whatever. Don't set CCCDLFLAGS since we don't use it anyway. Take care to avoid modifying lib/Config.pm without reason Visit DynaLoader for `make clean'. (Previously only did so for `make realclean'.) @echo "Note that make realclean does not delete config.sh" Include config.h dependency. U/i_db.U config_h.SH config.H Remove unwanted quotes around db_hashtype and db_prefixtype. configpm Allow specification of alternate name for lib/Config.pm, so the makefile mv-if-diff trick saves needless re-making. ext/DynaLoader/DynaLoader.pm Updated warning messages and comments. ext/DynaLoader/dl_hpux.xs Updated to version 2.1. Now uses bootstrap files. ext/util/make_ext Explicitly use #!/bin/sh to start it up. This is useful for testing make_ext. Improve & simplify Nested::Extension::Processing. More robust handling of `make clean'. hints/hpux_9.sh Support both the bundled and unbundled compilers. hints/next_3_2.sh Back to using -posix rather than POSIX_SOURCE. And that only for ext/POSIX/POSIX.xs. installperl Special ranlib treatment for NeXT, which gets confused about timestamps in libraries, even when you just copy the library. Supply missing '$' in samepath() function. lib/AutoSplit.pm New parameters. lib/ExtUtils/MakeMaker.pm Upgraded from 3.8 to 4.01. lib/ExtUtils/xsubpp Documentation changed from man to pod. lib/Getopt/Long.pm Avoid typo warning. Drop unused $optx. lib/Text/Tabs.pm Fix package name. makedepend.SH Explicitly start with $startsh. Catch cpp that prints # <stdin> instead of line numbers. perl.h Fix bonehead mistake that ended up calling my_fmod even if not needed. perl_exp.SH also add symbols from interp.sym proto.h Delete 2 redundant prototypes (newBINOP and newUNOP). util.c Add (char *) casts to unsigned char args to bcmp. x2p/a2p.h Rearrange order of <string?.h> and bcopy & bzero stuff. Change a few function prototypes to void, to reflect actual usage. x2p/a2py.c Change a few function types to void, to reflect actual usage. x2p/handy.h Make *alloc declarations match those in x2p/util.c. x2p/util.c Make *alloc declarations match those in x2p/handy.h. x2p/walk.c Add a (Size_t) cast for comparison of 1 to the result of strlen(). Thanks to all who's work is included here. Little of it is mine.
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r--ext/DynaLoader/DynaLoader.pm25
-rw-r--r--ext/DynaLoader/dl_hpux.xs44
2 files changed, 55 insertions, 14 deletions
diff --git a/ext/DynaLoader/DynaLoader.pm b/ext/DynaLoader/DynaLoader.pm
index 7cabf4e4e3..9a21dfd40b 100644
--- a/ext/DynaLoader/DynaLoader.pm
+++ b/ext/DynaLoader/DynaLoader.pm
@@ -54,15 +54,13 @@ push(@dl_library_path, split(/:/, $ENV{'LD_LIBRARY_PATH'}))
# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
-&boot_DynaLoader if defined &boot_DynaLoader;
+boot_DynaLoader() if defined(&boot_DynaLoader);
-print STDERR "DynaLoader.pm loaded (@dl_library_path)\n"
- if ($dl_debug >= 2);
-# Temporary interface checks for recent changes (Aug 1994)
-if (defined(&dl_load_file)){
-die "dl_error not defined" unless defined (&dl_error);
-die "dl_undef_symbols not defined" unless defined (&dl_undef_symbols);
+if ($dl_debug){
+ print STDERR "DynaLoader.pm loaded (@dl_library_path)\n";
+ print STDERR "DynaLoader not linked into this perl\n"
+ unless defined(&boot_DynaLoader);
}
1; # End of main code
@@ -120,8 +118,15 @@ sub bootstrap {
warn "$bs: $@\n" if $@;
}
- my $libref = DynaLoader::dl_load_file($file) or
- croak "Can't load '$file' for module $module: ".&dl_error."\n";
+ # 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
+ # C code of the extension XS file. Perl reports the error as being
+ # in this perl code simply because this was the last perl code
+ # it executed.
+
+ my $libref = dl_load_file($file) or
+ croak "Can't load '$file' for module $module: ".dl_error()."\n";
my(@unresolved) = dl_undef_symbols();
carp "Undefined symbols present after loading $file: @unresolved\n"
@@ -131,6 +136,8 @@ sub bootstrap {
croak "Can't find '$bootname' symbol in $file\n";
dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
+
+ # See comment block above
&{"${module}::bootstrap"}(@args);
}
diff --git a/ext/DynaLoader/dl_hpux.xs b/ext/DynaLoader/dl_hpux.xs
index 0558e40eaa..d2c405ecdc 100644
--- a/ext/DynaLoader/dl_hpux.xs
+++ b/ext/DynaLoader/dl_hpux.xs
@@ -1,5 +1,6 @@
/*
* Author: Jeff Okamoto (okamoto@corp.hp.com)
+ * Version: 2.1, 1995/1/25
*/
#ifdef __hp9000s300
@@ -38,13 +39,35 @@ dl_load_file(filename)
char * filename
CODE:
shl_t obj = NULL;
+ int i, max;
+ GV *gv;
+ AV *av;
+
+ gv = gv_fetchpv("DynaLoader::dl_resolve_using", FALSE, SVt_PVAV);
+ if (gv) {
+ av = GvAV(gv);
+ max = AvFILL(av);
+ for (i = 0; i <= max; i++) {
+ char *sym = SvPVX(*av_fetch(av, i, 0));
+ DLDEBUG(1,fprintf(stderr, "dl_load_file(%s) (dependent)\n", sym));
+ obj = shl_load(sym,
+ BIND_IMMEDIATE | BIND_NONFATAL | BIND_NOSTART | BIND_VERBOSE,
+ 0L);
+ if (obj == NULL) {
+ goto end;
+ }
+ }
+ }
+
DLDEBUG(1,fprintf(stderr,"dl_load_file(%s): ", filename));
obj = shl_load(filename,
BIND_IMMEDIATE | BIND_NONFATAL | BIND_NOSTART | BIND_VERBOSE, 0L);
+
DLDEBUG(2,fprintf(stderr," libref=%x\n", obj));
+end:
ST(0) = sv_newmortal() ;
if (obj == NULL)
- SaveError("%s",Strerror(errno)) ;
+ SaveError("%s",Strerror(errno));
else
sv_setiv( ST(0), (IV)obj);
@@ -64,12 +87,23 @@ dl_find_symbol(libhandle, symbolname)
DLDEBUG(2,fprintf(stderr,"dl_find_symbol(handle=%x, symbol=%s)\n",
libhandle, symbolname));
status = shl_findsym(&obj, symbolname, TYPE_PROCEDURE, &symaddr);
- DLDEBUG(2,fprintf(stderr," symbolref = %x\n", symaddr));
+ DLDEBUG(2,fprintf(stderr," symbolref(PROCEDURE) = %x\n", symaddr));
ST(0) = sv_newmortal() ;
- if (status == -1)
- SaveError("%s",(errno) ? Strerror(errno) : "Symbol not found") ;
- else
+ if (status == -1) {
+ if (errno == 0) {
+ status = shl_findsym(&obj, symbolname, TYPE_DATA, &symaddr);
+ DLDEBUG(2,fprintf(stderr," symbolref(DATA) = %x\n", symaddr));
+ if (status == -1) {
+ SaveError("%s",(errno) ? Strerror(errno) : "Symbol not found") ;
+ } else {
+ sv_setiv( ST(0), (IV)symaddr);
+ }
+ } else {
+ SaveError("%s", Strerror(errno));
+ }
+ } else {
sv_setiv( ST(0), (IV)symaddr);
+ }
int