distutils problem with interdependent modules

Gordon McMillan gmcm at hypernet.com
Mon Dec 24 08:25:55 EST 2001


Daniel Wexler wrote:

[snip]

> I don't get it.  How should I be segmenting my code?
> I have two Python C extensions, FOO and BAR.  BAR is
> dependent on FOO.  How should these be compiled, linked
> and used together?

What you're *supposed* to do is use CObjects (which 
basically wrap a void pointer) to pass the C-level API
between them. That is, remove all *formal* dependencies
of BAR on FOO. Have BAR load FOO using PyImport_Import 
(or one of it's kin) and then pull a CObject out of it's
dict, unwrap it and use the function pointers in it.

Depending on the complexity of the API, this may be as
much of a PITA as using implicit loading and solving the 
interdependcy problems.

-- Gordon
http://www.mcmillan-inc.com/





More information about the Python-list mailing list