Static/Shared libs and extension advice

Marc Poinot Marc.Poinot at onera.fr
Tue Sep 25 05:26:38 EDT 2001


Hi, I need a piece of advice.

I have two libraries (say A and B) and I want to have a wrapper for
each (pyA, pyB). But, the B librarie is built using the A calls, and
therefore requires it at link time.

Library A has static variables.

If I load pyB, the shared lib "loads" the statics. If I want now to
use pyA, Python uses the other shared library for the A extension and
I have another set of static values :(
Thus, I cannot use A calls and B calls at the same time with two
separate extensions.

The way I use is to call the initA() in the initB(), get the module
python object and set it into the B module dictionnary. Then I can
call both A and B functions through pyB and still have two extensions.
But the user has to be very careful about name scope and the side effects of
two separate set of static values if he imports pyA now.

I've seen several other ways to force to import a module from another
one (e.g. into Numpy), however it looks like they have not my static
variable problem.

Any hint, good design practice, extension module example?

Marcvs [alias Yes, I can do static link...]




More information about the Python-list mailing list