|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Typemap help
I'm having a bit of trouble wrapping my head around this. I'd
appreciate some help.
I've got this typedef: class Description : <...> { public: typedef const char* Key; and then a use of it as: bool add_tag(const Key& key, const Parameter& value); I'm getting errors regarding the argument type: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "PyAsgardLib.py", line 514, in add_tag return _PyAsgardLib.Description_add_tag(*args) TypeError: in method 'Description_add_tag', argument 2 of type 'LWSDK::Description::Key const &' So, I assume it need a typemap, something like: %typemap(in) LWSDK::Description::Key const & { $1 = PyString_AsString($input); } %typemap(out) LWSDK::Description::Key const & { $result = PyString_FromString($1); } Internally, SWIG is declaring: LWSDK::Description::Key *arg2 = 0 ; But, the combinations of references and pointers is just confusing me. What's the correct typemap for this? Render me gone, |||
Bob ^(===)^
---------------------------------oOO--(_)--OOo---------------------------------
The world needs more cults. They attract stupidity like a
magnet attracts metal, and they're self cleaning.
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Typemap helpFound it. Because "const Key&" ends up being "const char **", a
temporary variable is needed on the "in" map: %typemap(in) LWSDK::Description::Key const & (char* temp_Key) { temp_Key = PyString_AsString($input); $1 = (LWSDK::Description::Key*)&temp_Key; } and a dereference on the "out": %typemap(out) LWSDK::Description::Key const & { $result = PyString_FromString(*($1)); } ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
| Free embeddable forum powered by Nabble | Forum Help |