How to link a C extension module on Mac OS X?

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Mon Jul 28 00:05:58 EDT 2003


Michael Hudson wrote:
> It works.  Don't know why, mind -- the files end .so when shared
> libraries usually end .dylib on OS X -- but it does.

I think Darwin is using something like the original BSD
model for shared libraries, in which the .so was really
just a naming convention, and any object file could be
loaded at run time (albeit with a possible performance
penalty if it wasn't designed for it).

Although Darwin seems to have a couple of different
flavours of dynamic linking. When the OS X docs talk about
a "dynamically linked" library, they seem to be referring
to a mechanism which defers resolving references to functions
until the first time they're called. It appears that it's
possible for code to be loaded at run time without being
"dynamically linked" in that sense.

It probably helps that Python is explicitly loading the
code, in which case it probably doesn't matter what the
filename is.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list