develooper Front page | perl.perl5.porters | Postings from October 1999

[ID 19991007.005] DynaLoader/dl_aix.xs problem using load andunload on AIX

October 7, 1999 12:06
[ID 19991007.005] DynaLoader/dl_aix.xs problem using load andunload on AIX
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[Please enter your report here]
I have identified a problem with Perl's DynaLoader/dl_aix.xs
which is very specific to the IBM AIX platform.
This problem is specific to Perl to C extensions that
first call C functions but the C functions call C++ functions
and the C++ code makes use of statics.  The statics are not
getting initialized.  To get them to initialize properly the
load and unload function calls in DynaLoader/dl_aix.xs need to be
replaced with libC_r.a function calls loadAndInit and
terminateAndUnload.  dl_aix.xs also now needs
to include the load.h file, on my system I included
#include </usr/ibmcxx/include/load.h>.  In addition, the code
now needs to link with -lC_r.
Making these changes should not impact any extension that
doesn't require this fix.

If for some reason you do not want to patch dl_aix.xs, I would
strongly recommend that at a minimum a README for aix (README.aix)
be created that identifies this problem and suggests this work around.

Linking with libC_r.a should not be a problem since it is
shipped with base AIX.  This change was made to the Perl code
that is now shipped with AIX 4.3.3.  I just put a post out to
comp.lang.perl.misc today (October 7, 1999) announcing this.
I have also been using both Perl5.005_02 and then Perl5.005_03 fixed
with my patch for roughly one year and it has not broken any other
part of Perl.  I have now, twice in the last 3 weeks, been contacted
by two different IBMers, one in IBM Research and one in Burlington
Vermont, confirming that this fix was also required for some of
their Perl to C extensions to work properly.

This was one of the most difficult bugs that I've had to
tackle in IBM.  Patching base Perl specifically the
DynaLoader/dl_aix.xs will save many other people from the
4 weeks of pain that I went through.  Being a new developer
of Perl to C extensions last year, I first
assumed this problem was in my code, it wasn't, next I figured
it must be in the code I was calling, it wasn't, finally
after scanning through many IBM internal news groups I hit
on a similar fix someone had to make to Rexx calling C calling
C++.  The fix worked for me and was very easy to make.
For people outside of IBM who don't have access to our internal
news groups this would be an extremely painful bug to resolve.

I would be very willing to download and build a new level of Perl
that includes this fix to verify that the fix was done correctly
and works on the 1 out of 5 of my extensions that requires it.

Please feel free to contact me with questions!
Stephanie Beals
(914) 433-7948

[Please do not change anything below this line]

Site configuration information for perl 5.00503:

Configured by root at Wed Aug 11 15:58:01 CDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=aix, osvers=, archname=aix
    uname='aix funny 3 4 000001716600 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    cc='cc', optimize='-O', gccversion=
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384'
    ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags ='-s'
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lnsl -ldbm -ldl -lld -lm -lc -lcrypt -lbsd -lPW -lC_r
    libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-bE:perl.exp'
    cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(B
ASEEXT).exp -b noentry -lc'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/ksh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About