Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Dealing with module envy under HPUX 10.20

 Zsh Gurus:

   Suffering module envy can be a sad thing! I have tested the following
   which seems to get the modules stuff working fine under HPUX 10.20.
   (HPUX 11 comes pre-armed with dlopen() et al so it is not needed there).
   I am totally unfamiliar with the configure magic so I'm hoping someone
   who knows better can make that part more elegant so that module support
   for hpux 10 is supported out of the box.

   Heres what I did (against stock zsh-3.1.5):

   a) The important bits ...

     o Put the included dlfcn.h header file where it can be seen
       Obviously the macros could just as easily have been functions. 
       Be aware there is a global variable in here (zsh_gl_sym_addr)
       used as a temporary.
       These macros redefine the dlopen() suite in terms of the shl_load()
       type funcs.
   b) faking out configure coz I dont know any better ...

     o adjusted configure by changing

       void *symlist1 = {

       void *symlist1[] = {

       Otherwise the test fails as the compile gives errors compiling
       the test proggie.

    o The test for presence of dlopen() needs to be faked out beacuse it 
      is in the header as a macro rather than a library. I simply created
      a little libdl.a with stub entries :

      int dlopen() { return(0);}
      int dlclose() { return(0);}
      int dlsym() { return(0);}
      int dlerror() { return(0);}

      cc -Aa +DAportable -c stubs.c; ar ruv libdl.a stubs.o

      Make sure the LDFLAGS see this library and also add -ldld

   o Make sure that for HPUX 10. we have a -DHPUX_10_DL compiler flag.

  Gene Cohler
  Bear Stearns & Co.
 * HPUX 10.0 dynamic loader stuff
 * Not needed under HPUX 11.0 which has dlopen() etc.
 * This header needs to be seen with -DHPUX_10_DL 
 * Note: configure needs 
 *    a)  void *symlist1 = { 
 *        changed to
 *        void *symlist1[] = {
 *        Otherwise configure thinks dynamic stuff is broken.
 *    b) The test for dlopen needs to be faked out 
 *       I created a dummy with stub entries for dlopen, dlerror and
 *       dlsym otherwise configure thinks there are no entries.
 *       There is probably a smarter way.
 * Tested using HP' cc compiler under HPUX 10.20.
 * Compiled with -Aa +DAportable

#if defined(HPUX_10_DL)   
#if !defined(DLFCN_INC)
#define DLFCN_INC 1

#include <dl.h>

char *zsh_gl_sym_addr ;

#define dlopen(file,mode) (void *)shl_load((file), (mode), (long) 0)
#define dlclose(handle) shl_unload((shl_t)(handle))
#define dlsym(handle,name) (zsh_gl_sym_addr=0,shl_findsym((shl_t *)&(handle),name,TYPE_UNDEFINED,&zsh_gl_sym_addr), (void *)zsh_gl_sym_addr)
#define dlerror() 0

Messages sorted by: Reverse Date, Date, Thread, Author