[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] SWIG %import



Daniel Russel wrote:
Apparently the %import directive is meant to be used with .i files rather than .h files.

No, %import is meant to be used with SWIG interface files, just like %include is. In many cases, regular header files are valid SWIG interface files, and that's the case with IMP. By %import'ing all of IMP, you're telling SWIG about a whole bunch of classes it doesn't need to care about for impEM. So this change is unnecessary - unless it does actually fix a problem you're having (in which case, add a testcase which crashes with the current setup and works with your patch).

In addition, we are not properly sharing the swig runtime info between modules. Apparently we need to add " -DSWIG_TYPE_TABLE=IMP" to each compilation of a _wrap.cc so that the information is properly shared.

On the contrary, you only need to define that if you _don't_ want to share the information except with other modules that have the same type table. So we don't need this change either - by default everything is shared (and since we use namespaces properly we shouldn't conflict with other SWIG modules). See http://www.swig.org/Doc1.3/Modules.html#Modules_nn2 Admittedly that documentation is a little misleading, so again, if you need it to fix a problem, add a testcase.

I would also propose changing IMP_exceptions.i as follows in order to allow other libraries to reuse the exception handling function by %including IMP_exceptions.i rather than redefine a new one:

Sounds good to me. There's been no need to do that thus far because the impEM guys seem to be allergic to exceptions. ;)

	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle