Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create a dynamic lib of Python API ?

2 views
Skip to first unread message

dag4004

unread,
May 22, 2002, 5:48:40 AM5/22/02
to
Hello,

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 ?

Thanks


Oleg Broytmann

unread,
May 22, 2002, 5:58:11 AM5/22/02
to

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/ p...@phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.


A.M. Kuchling

unread,
May 22, 2002, 12:18:25 PM5/22/02
to
In article <mailman.102206157...@python.org>,
Oleg Broytmann wrote:
> make distclean
> OPT="-O2" CC=gcc CFLAGS="-O2" CXX=g++ CXXFLAGS="-O2" LDFLAGS="-s" ./configure

I think -fPIC should be added to the CFLAGS, too, to generate
relocatable object code.

--amk

0 new messages