From: Nitro <ni...@dr...> - 2006-11-25 10:39:10
|
Am 25.11.2006, 01:14 Uhr, schrieb William S Fulton <ws...@fu...>: > William S Fulton wrote: >> Nitro wrote: >>> Hello, >>> >>> I ran into the same issue as documented here >>> http://permalink.gmane.org/gmane.comp.programming.swig.devel/14938 . >>> Namely, %extend { static int someAttr; } doesn't generate proper code. >>> I >>> am also swigging to multiple target languages. >>> Has anybody found a solution yet? >>> >> >> Using the %attribute feature might be a suitable workaround along with >> some helper get/set methods which you don't expose directly to SWIG. >> Take a look for %attribute in the CHANGES file. >> > Actually on second thoughts, you'd probably have to expose the methods > in %extend and I'm not entirely sure that %attribute supports static > attributes. Anyway, might be worth trying. Thanks for your hint. I already tried that. It doesn't work, because %attribute works like this: %define %_attribute(Class, Wrap, type, attr, getcode, setcode) %extend Class { type attr; } %{ #define Wrap ##_## attr ## _get(_t) getcode #define Wrap ##_## attr ## _set(_t, _val) setcode %} %enddef So it suffers the same problem when doing a manual %extend + static - the getters/setters are not called. -Matthias |