[Insight-developers] CableSwig -CIndex question

Zachary Pincus zpincus at stanford.edu
Sun Jan 15 02:49:32 EST 2006


Hi folks,

I've been using CableSwig to work on a new wrapping methodology for  
ITK, and I've run into some questions about how cswig works.

Specifically, one can pass in 'master index' files to cswig (via the - 
CIndex option) to tell cswig which classes have been wrapped  
elsewhere. However, I wonder if there's a way to specify (perhaps in  
the master indices) which module each class has been wrapped in.

The problem that appears without this is that if there are several  
modules wrapped into separate dynamic libraries, the cswig generated  
code doesn't know about this. This results in attempts to reference  
symbols from a different module without first loading the module.

Python example: Module _Foo defines symbol _Frob; something in module  
Baz requires a _Frob. Because of the CIndex files, cswig knows that  
_Frob exists in some module, so it creates a python call 'import  
_Frob'. This fails unless 'import _Foo' has been previously called.

The upshot of all of this is that multi-module cswig files don't work  
correctly without some manually-produced scripts which ensure that  
files are imported in the proper order to satisfy these sort of  
dependencies.

If cswig, on the other hand, knew about which symbols were in which  
modules, this would be all unnecessary. So -- is there such an  
ability already in cswig? If not, does anyone know if it would be  
easy to add -- I could try my hand at patching it.

Zach Pincus


More information about the Insight-developers mailing list