zsh-workers
 help / color / mirror / code / Atom feed
From: Gene Cohler <gene@Bear.COM>
To: zsh-workers@math.gatech.edu
Subject: Dealing with module envy under HPUX 10.20
Date: Tue, 15 Dec 1998 21:20:36 -0500	[thread overview]
Message-ID: <19981215212036.J26659@bear.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]


 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 = {
       
       to

       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.

[-- Attachment #2: dlfcn.h --]
[-- Type: text/plain, Size: 1120 bytes --]

/*
 * 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>
#define RTLD_LAZY BIND_DEFERRED
#define RTLD_GLOBAL DYNAMIC_PATH

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
#endif
#endif

             reply	other threads:[~1998-12-16  2:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-16  2:20 Gene Cohler [this message]
1998-12-16 16:12 ` PATCH: 3.1.5-pws-3: Dynamic loading under HPUX 10 Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19981215212036.J26659@bear.com \
    --to=gene@bear.com \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).