From: Ross H. <bru...@ya...> - 2007-02-23 04:47:38
|
Hi, I'm trying to use the extend directive to make a c struct more class like in python. This used to work but something has changed in swig, i think. The problem seems to be that a struct defined and extended in one module is fine, but the extended type is not known to the other module for typechecking so there is a failure. Following is the python bit, the c codes and swig interface files are attached. swig 1.3.25 Python 2.4.2 (#1, Feb 22 2006, 18:50:47) [GCC 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mod1 as m1 >>> import mod2 as m2 >>> num=m1.mycomplex(1.0,2.0) >>> m1.printcomplex1(num) 1.000000 2.000000 >>> m2.printcomplex2(num) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: argument number 1: a 'mycomplex *' is expected, 'PySwigObject(_p__mycomplex)' is received ____________________________________________________________________________________ Have a burning question? Go to www.Answers.yahoo.com and get answers from real people who know. |