[Matrix-SIG] Re: [PSA MEMBERS] RTLD_GLOBAL gone from 1.5.2; alternative?

Jim Fulton jim@digicool.com
Tue, 19 Jan 1999 22:05:53 +0000


Zane Motteler wrote:
> 
> Hello colleagues,
> 
> In version 1.5.2, the flag RTLD_GLOBAL has been removed from
> importdl.c. This flag, if on, allows routines in a shared object
> to access global variables in another. If it is off, attempting
> to call a routine in another shared object causes a segmentation
> fault and a core dump. This is unacceptable behavior to me, as
> I have extensions which rely on being able to call
> PyArray_FromDimsAndData. I do not want to have to hand edit
> importdl.c with each release, besides which this may cause
> somebody else's code to come to grief. Likewise, I do not
> want to have to link these modules into python itself.

Do you claim that this feature (RTLD+GLOBAL) is portable?
I'd be surprized if it was.

> Has anybody out there solved the problem of how to call a routine
> in a shared module from another shared module without editing
> core python or changing how it is linked?

Yes and no.  IMO, any module that want's to export a C
interface should do so explicitly using a Python CObject.
This relies only on Python's import machinery and should 
work on any system on which Python can do dynamic linking.

To see how this works, look at how cStringIO exports a 
C API and how cPickle imports it.  

Maybe someone will volunteer to provide an exported 
C interface for the array module.

Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (540) 371-6909              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.