Hi All

New to this list.

I am in a quandry and would like some help.

I am embedding perl (Perl 5.8.0) in my C executable on a HP-UX 11i PA-RISC 2.0 machine.  After the call to perl_alloc, my program invokes a boot strap function to extend the perl interepreter to access some of our C functions.

Till last week, everything worked fine.

Then we embedded a Java VM in the executable.  Now, the boot strap routine core-dumps if I link in the JVM library.  If I remove the JVM library on the link , no core dumps occur.

The strange thing is that the core dump happens because the boot strap routine (created via XSUBPP) points to memory that was freed in the main program.  The memory has not been cleared out.  The value of a perl variable called PL_markstack_ptr points to this freed memory.  The memory has not been cleared out and the contents from the previous usage are still available.  The boot strapper calls the macro dXSARGS, which calulates the value of a variable called ax which is a function of the contents PL_markstack_ptr and PL_stack_base.  Since PL_markstack_ptr is garbage, so is ax.  ax is being used as an index in to an array and since ax is garbage, (a very large number), core dumps.

All libraries are shared libraries.  The code to embde the perl interpreter and java VM are in a library.


Thanks

Komal Sundaram


Perl was linked using the following options



Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=hpux, osvers=11.11, archname=PA-RISC2.0-thread-multi
    uname='hp-ux hpslic b.11.11 u 9000785 2014916484 unlimited-user license '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags =' -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ',
    optimize='+O2 +Onolimit',
    cppflags='-Aa -D__STDC_EXT__ -D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings'
    ccversion='B.11.11.06', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/usr/bin/ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lnsl -lnm -lndbm -lmalloc -ldld -lm -lpthread -lc -lndir -lcrypt -lsec
    perllibs=-lnsl -lnm -lmalloc -ldld -lm -lpthread -lc -lndir -lcrypt -lsec
    libc=/lib/libc.sl, so=sl, useshrplib=true, libperl=libperl.sl
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
    cccdlflags='+Z', lddlflags='-b +vnocompatwarnings -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under hpux
  Compiled at Jun 27 2005 21:48:36
  @INC:
    /space2/komal/perl-5.8.0/lib/5.8.0/PA-RISC2.0-thread-multi
    /space2/komal/perl-5.8.0/lib/5.8.0
    /space2/komal/perl-5.8.0/lib/site_perl/5.8.0/PA-RISC2.0-thread-multi
    /space2/komal/perl-5.8.0/lib/site_perl/5.8.0
    /space2/komal/perl-5.8.0/lib/site_perl
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to