[Pythonmac-SIG] Python shared libraries

Bob Ippolito bob at redivi.com
Wed Sep 10 14:46:25 EDT 2003


On Wednesday, Sep 10, 2003, at 13:09 America/New_York, Mark Easton 
wrote:

> Bob,
>
> Thanks for the detailed advice, however there is one problem that I can
> see in the following sentence:
>
> "If you're loading the Python framework dynamically, you want to use 
> the
>
> CFBundle API, not the NSCreateImageFromFile or dlopen wrappers."
>
> Now as far as I know, none of the 3 .NET implementations that run on 
> Mac
> OS X (Mono, SSCLI and PNET) use the CFBundle API to access shared
> libraries which means I currently need access to a naked shared 
> library.
> While I can start investigating the possibility of PNET and Mono
> implementing mechanisms that will work with both Frameworks and naked
> shared libraries, in the meantime I need to build a naked shared 
> library

That's because you want to access a framework and not a shared library 
(dylib)!  There's a different API for frameworks that's nicer and 
provides more information.  The fact that they don't know how to use 
frameworks and the relevant API dynamically is a missing feature.

If you REALLY need to use NSCreateImageFromFile you can use 
/Libraries/Frameworks/Python.framework/Versions/Current/Python as the 
image, it's just about the same thing as the libpython2.3.dylib you 
would get otherwise (which I mentioned before, and is in Apple's 
documentation).  The Right Way would be to extend the .NET 
implementation you're using with support for the CFBundle API.  This 
would allow access to runtime linking of frameworks (typically 
.framework) and plug-ins (typically .bundle).

You don't need to build a shared library, please don't bother.  There's 
enough OS X Python to go around as-is (Apple Python, Jack's (official) 
MacPython, Fink's Python), I'd hate to see another one.

-bob




More information about the Pythonmac-SIG mailing list