From: Abhinandan J. <ja...@he...> - 2007-09-29 06:13:57
|
I an having trouble getting Python proxy classes to work when using the %import directive. I have a C++ class X and another Y derived from X. I am using SWIG to build an extension for class X using an X.i file. In Y.i, if I use the %include X.i directive, then the resulting Python proxy class Y shows up as derived from class X's Python proxy class. However this also leads to duplicate wrapper code for some methods being generated as well. My understanding is that the correct way to avoid this is to use instead the %import X.i directive in Y.i. This does indeed get rid of the duplicative code. However, the Y's Python proxy class no longer inherits from X's Python proxy class, but instead simply from the 'object' class. This means that I am no longer able to access any of X's methods from an instance of Y in Python. I suspect that I am either not using the %import directive correctly or am misunderstanding its purpose. Any help/advise on this problem would be much appreciated. Thanks in advance. I am using pretty recent version of SWIG from the repository. Abhi |