[Pythonmac-SIG] re: Interpreting a crash dump

Bob Ippolito bob at redivi.com
Sat Feb 21 10:02:59 EST 2004


On Feb 21, 2004, at 7:13 AM, Jack Jansen wrote:

>
> On 21 Feb 2004, at 10:28, Robin Becker wrote:
>
>> I was able to solve the problem of mismatched strncpy in my dylib
>> embedded python application by the following strategy.
>>
>>
>> 1) Switch from -flat_namespace to -twolevel_namespace
>> 2) Fix up a missing external _environ by using my own version.
>> 3) Ensure the client was prepared for the double definition of 
>> _environ.
>>
>> It seems environ is normally supplied by crt1 (ie the main startup). 
>> How
>> do other macpythoneers get round the problem (ie python internals 
>> refer
>> to _environ). The linker seems unable to do a mixed strategy ie link
>> evrything twolevel except for specified externals.
>
> Same strategy: provide your own _environ. The code is somewhere in
> posixmodule.c.
>
> As to the mixed strategy: Mach-O cannot really do this, there is no 
> way to
> define references back from a shared library to the hosting program. 
> On most
> unixen the distinction between shared libraries and plugins doesn't 
> exist,
> so that probably takes care of the situation.
>
> Hmm, no, on second thoughts that isn't the complete story. I don't 
> know why
> Apple aren't storing _environ in libc. (or libSystem.dylib, or 
> whatever).

They are storing it in libc, as a function.

/usr/include/crt_externs.h
	extern char ***_NSGetEnviron(void);

-bob




More information about the Pythonmac-SIG mailing list