Re: creating dynamic objects with Python

Guido.van.Rossum@cwi.nl
Tue, 16 Aug 1994 17:27:46 +0200

> My system finally has dynamic linking and I would like to turn most
> of the "optional" modules into dynamic libraries.
>
> I build my shared object using the following line:
>
> cc -O -K i486 -K pic -belf -G -I.. -I../Include -DHAVE_CONFIG_H -c rotormodule.c -o rotormodule.so -lm
>
> This builds correctly. And creates a .so file that is about 10k.
> Then when I try to import it, it complains that it cannot find things
> like 'newobject'.
>
> If I link against all the Python libs, then I get a .so file that is
> about 240K and it still cannot find some things...
>
> What do other people do?

What does your manual say about dynamically loaded libraries that call
functions defined in the main overlay? In SunOS/SVR4 dynamic loading,
this works. Linking against all the Python libs doesn't sound like a
good idea since you would end up having duplicates of all code (a
waste of space) and of all data (which might cause *very* strange
effects).

Did you perhaps strip your main python executable?

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>