From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11065 invoked from network); 16 Dec 1998 02:27:25 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Dec 1998 02:27:25 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id VAA26608; Tue, 15 Dec 1998 21:26:34 -0500 (EST) Resent-Date: Tue, 15 Dec 1998 21:26:34 -0500 (EST) Date: Tue, 15 Dec 1998 21:20:36 -0500 From: Gene Cohler To: zsh-workers@math.gatech.edu Subject: Dealing with module envy under HPUX 10.20 Message-ID: <19981215212036.J26659@bear.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=7AUc2qLy4jB3hD7Z X-Mailer: Mutt 0.95i Resent-Message-ID: <"FKlx3.0.hV6.QfnTs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4811 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii 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. --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Description: dlfcn.h Content-Disposition: attachment; filename="dlfcn.h" /* * 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 #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 --7AUc2qLy4jB3hD7Z-- Content-Type: text/plain ******************************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. ********************************************************************************