Anyway, am looking in to these things since IMP currently does not work reliably with other swig modules which use IMP. For example, doing for p in IMP.Particles(): print p crashes on my linux box if IMP and another swig library are loaded. Try adding that line to anything in the IMPEM tests to see. On Jan 3, 2008, at 10:47 AM, Ben Webb wrote: Daniel Russel wrote:Apparently the %import directive is meant to be used with .i filesrather than .h files. To quote the manual: To create the wrapper properly, module derived needs to know the base class and that it's interface is covered in another module. The line %import "base.i" lets SWIG know exactly that. The common mistake here is to %import the .h file instead of the .i, which sadly won't do the trick. Another issue to take care of is that multiple dependent wrappers should not be linked/loaded in parallel from multiple threads as SWIG provides no locking - for more on that issue, read on. In addition, we are not properly sharing the swig runtime info betweenmodules. Apparently we need to add " -DSWIG_TYPE_TABLE=IMP" to eachcompilation of a _wrap.cc so that the information is properly shared. Well, when I don't have it, swig doesn't handle casts correctly across modules, and the manual does explicitly say otherwise: The runtime functions are private to each SWIG-generated module. That is, the runtime functions are declared with "static" linkage and are visible only to the wrapper functions defined in that module. The only problem with this approach is that when more than one SWIG module is used in the same application, those modules often need to share type information. This is especially true for C++ programs where SWIG must collect and share information about inheritance relationships that cross module boundaries. |