Python proper on Linux, `.a' vs `.so'

Gerhard Häring gh at ghaering.de
Wed Jun 4 21:44:31 EDT 2003


Francois Pinard wrote:
> Hi to all Python lovers.
> 
> Today, I wanted to use some functionality already written as a Python into
> a few C main programs.  The size of each generated executable is over 800K,
> and I suspect that most of it comes from the fact it is linked with:
> 
>    /usr/lib/python2.2/config/libpython2.2.a
> 
> I wonder if there is any deep reason why this could not have been
> installed as a `.so' library right from the Python installation itself.

On some platforms (for example Linux), Python can be built as a shared 
library since Python 2.3.

For Python 2.2 and earlier it is possible with patching the build 
process. Debian does this.

> Is there any counter-indication at having done so?  
> If yes, I'm a bit
> curious about what these difficulties might be.  If not, is there any
> simple stunt I could do for creating a usable `.so' library?
> 
> Since the original C programs executables are not so big, less than 100K
> each (relying on installed shared libraries -- of course), I feel that
> the idea of using Python modules from within C applications would "sell"
> better if it was not blatantly bloating the size of executable files.

Maybe. Does Linux share .so's across different applications? If not, all 
you save is some hard disk space.

-- Gerhard





More information about the Python-list mailing list