[plt-scheme] Dynamic loading of multiple mzscheme modules on hpux built with SWIG

From: Tim Brown (tim.brown at cityc.co.uk)
Date: Wed Mar 30 09:12:58 EST 2005

I cannot get hp's shl_load() mechanism to work in the desired way
(it always results in the symbols being resolved as I describe below).

By setting scheme to use dlopen() and family; I can build .so extensions
which link as expected. Using the mzc linker:


/************** HP/UX with cc or gcc ****************/

#if defined(__hpux)

# define SCHEME_PLATFORM_LIBRARY_SUBPATH "parisc-hpux"

# include "uconfig.h"

/* how it is in the source currently */
/*
# undef UNIX_DYNAMIC_LOAD
# define SHL_DYNAMIC_LOAD
*/

/* HPUX 11 has dlopen() */
# define UNIX_DYNAMIC_LOAD
# undef SHL_DYNAMIC_LOAD
...


I don't know how this will impact on lower versions of HPUX (I
suspect 10 will be OK, but 9 will not).

Regards,

Tim

Tim Brown wrote:
> Folks,
> 
> I have build a collection of modules for mzscheme (209) using SWIG:
> 
> Version 1.3.24
> ...
> Compiled with aCC [hppa2.0w-hp-hpux11.00]
> 
> I am using "mzc" (using  the HP aCC compiler) to build and link them.
> 
> I am fine loading up my first module:
> 
>   (require (lib "module1.ss" "ccl"))
> 
> But when I go to require my second module:
> 
>   (require (lib "module2.ss" "ccl"))
> 
> I end up with the following error in Scheme:
> 
>   require: unknown module: |,/usr/local/plt/collects/ccl/module2|
> 
> I have isolated this fault down to module2's scheme_initialize()
> attempting to call its own scheme_reload(), but picking up the
> scheme_reload() in module1.
> 
> How do I build shared libraries which call their own functions
> themselves. Remember that I am limited by:
> 
> 1. the modules are auto-generated by swig, and therefore I can't
>    delegate the scheme_reload functionality to a static function
> 
> 2. mzscheme contracts me to use those names, by its "module" API.
> 
> 3. as much as I may love gcc, I am stuck with acc/aCC so I *really*
>    need compiler/linker flags for those.
> 
> Thanks very much in advance for you help.
> 
> Regards,
> 
> Tim Brown

-- 
Tim Brown <tim.brown at cityc.co.uk> |            City Computing Limited |
T: +44 20 8770 2110               |      City House, Sutton Park Road |
F: +44 20 8770 2130               |       Sutton, Surrey, SM1 2AE, GB |
BEAUTY: What's in your eye when you have a bee in your hand.__________/



Posted on the users mailing list.