[Pythonmac-SIG] Extensions for static versus framework MachoPython

Jack Jansen Jack.Jansen@oratrix.com
Tue, 9 Jul 2002 00:00:10 +0200


On maandag, juli 8, 2002, at 12:12 , Jack Jansen wrote:

>
> On vrijdag, juli 5, 2002, at 10:37 , bill fancher wrote:
>>> I'm not sure why it doesn't complain, it may have something to 
>>> do with Python.framework being linked with -flat_namespace, 
>>> which it needs because it needs access to _environ (which 
>>> frameworks or dynamic libraries don't get, sigh, only main 
>>> programs).
>>
>> It doesn't complain because the *modules* are linked with 
>> -flat_namespace,
>>  so they know what libraries they "need" but not which library 
>> a particular symbol comes from.
>
> Aargh, you're right! Silly me, now if I can only remember why 
> this is. I'll try changing it, maybe it was just an oversight...
>
>> As for _environ, there's a way around that. From Mach-O 
>> Runtime Architecture, p.24:
>
> Tried this, but didn't get it to work without major surgery to 
> the Python core (removing all direct references to the _environ 
> global).

Tried it again, and I got it to work this time. I now have both 
python.exe and all the extension modules linked with two-level 
namespace, and handled _environ by making it a static variable 
and initializing it with _NSGetEnviron.

However, the cure appears worse than the problem: in stead of 
"just working" what happens now if you import a framework-based 
module into a non-framework-based Python is that Python crashes 
with a bus error:-(

I'll investigate a bit more, if anyone wants to help please 
speak up and I'll put the diffs up on sourceforge,

--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -
>
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig