How to create a dynamic lib of Python API ?

Oleg Broytmann phd at phd.pp.ru
Wed May 22 05:58:11 EDT 2002


On Wed, May 22, 2002 at 11:48:40AM +0200, dag4004 wrote:
> I dont want to compile Python staticaly again libpython.a but i want to
> create a dynamic lib of Python's API (like libpython.so for exemple) and
> compile the interpreter with it.
> 
> Does some one know how to do that ?

   The name of your libpython.a suggests that it is a variant of UNIX, but
what exactly is it? OS? compiler? I can help with Linux/gcc this way:

make distclean
OPT="-O2" CC=gcc CFLAGS="-O2" CXX=g++ CXXFLAGS="-O2" LDFLAGS="-s" ./configure
make || exit 1

mkdir .extract
(cd .extract; ar xv ../libpython2.2.a)
gcc -shared -o libpython2.2.so .extract/*.o
rm -rf .extract

PS. Python 2.3 will do it if configured with ./configure --enable-shared.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list