Python as a shared library on Unix

Paul Duffin pduffin at mailserver.hursley.ibm.com
Mon Jun 28 08:50:05 EDT 1999


Brian E Gallew wrote:
> 
> Then <mwh21 at cam.ac.uk> spoke up and said:
> > Paul Duffin <pduffin at mailserver.hursley.ibm.com> writes:
> >
> > > Is it possible to build Python itself as a small executable and a
> > > shared library, rather than an archive library which of
> > > course results in a monolithic executable.
> 
> Sure it is.  I've done it.  The problem is, doing this is even more
> platform dependent than just building shared libraries.  When I did
> it, it was a "by-hand" process, where I manually modified some files,
> forced all object files to be relocatable code, manually converted
> libpython.a to libpython.so.1.5.2, and so on.  What makes this
> difficult is that some Modules want to reference things in libpython,
> and sometimes it means linking the modules against -lpython, and

How does this work when Python is a monolithic executable ?

What do Modules link to then ?

They obviously cannot link to the python library as that will result
in duplicate stuff.

I thought that when Python loaded modules it had platform specific code
to manage the binding of the symbols to those exported from Python
itself (except on Windows which does not support this at all).

It sounds to me as though you need something like the Stubs mechanism
that Tcl and its extensions are starting to use.

> sometimes not.  It's ugly, and not for the faint of heart.  Further,
> the utility of such a hack quickly became questionable for me,
> considering that I'm never embedding python itself.
> 


-- 
Paul Duffin
DT/6000 Development	Email: pduffin at hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880	International: +44 1962-816880




More information about the Python-list mailing list