[Fwd: Re: [Pythonmac-SIG] OS X import bug?]

Marcel Prastawa prastawa@cs.unc.edu
Sat, 26 Jan 2002 07:53:49 -0500


Steven Majewski wrote:

> After replicating the problem Bob described, I tried building with libdl,
> but that seems to have broken some other imports. I haven't isolated
> what's going on -- it seems to depend on the order or the paths used.
> 
> Which version of libdl are you guys using ?  (and from where?)


Note: I may have done things differently from Bob, and I am doing this 
with the 2.2 release source (not CVS).

I am using libdl from Fink (the dlcompat package, version 20010831).
Does the import problem occur with flat namespace extensions that have 
undefined symbols? I encountered this too.

I got things to work by setting the RTLD_GLOBAL flag for dlopen, so that 
it behaves a bit more like dynload_next.

It's an ugly hack... In dynload_shlib.c instead of:

dlopenflags = PyThreadState_Get()->interp->dlopenflags;

I did:

dlopenflags = PyThreadState_Get()->interp->dlopenflags | RTLD_GLOBAL;

So that RTLD_GLOBAL is always set. Is there a better place for doing 
this? I haven't tested this thoroughly yet, but it seems to work fine.

Out of curiosity, is the 'identical binary name' problem with 
dynload_next a MacPython problem (that we could work out) or is it a 
problem with the OS X framework?

Marcel