From: Ervin H. <ai...@gm...> - 2013-02-08 22:48:30
|
Hello William, thanks for the reply, On Fri, Feb 08, 2013 at 07:18:28PM +0000, William S Fulton wrote: > > > >And as you can see the full swig command, the swig uses the > >hamlib.swg, which contains the typedef: > > > > 67 /* needed because rig.swg and rotator.swg macros require identifiers like arg (no spaces) */ > > 68 %header %{ > > 69 typedef char * char_string; > > 70 typedef const char * const_char_string; > > 71 typedef channel_t * channel_t_p; > > 72 typedef channel_t * const_channel_t_p; > > 73 %} > > 74 > SWIG does not parse code in %header, so it would not have seen the > typedefs above. See http://www.swig.org/Doc2.0/SWIG.html#SWIG_nn42 > As I wrote, I'm not a SWIG expert - and since I've started to debug this code, I didn't had too much time to have to know it. So, I don't understand, what does it mean, because I've leave the %header %{ and pair bracket, recompile the code, but then SWIG don't put anywhere the typedef, and C compiler has exited: CC hamlibpy_wrap.lo hamlibpy_wrap.c:3454:41: error: unknown type name ‘const_char_string’ hamlibpy_wrap.c:3455:42: error: unknown type name ‘const_char_string’ hamlibpy_wrap.c:3481:48: error: unknown type name ‘const_char_string’ hamlibpy_wrap.c:3482:44: error: unknown type name ‘const_char_string’ ... and so on... If I put the typedef macro to halibpy_wrap.c directly after SWIG generates that, the code has compiled correctly. Also, when I've changed all 'const_char_string' type to 'const char *' in hamlibpy_wrap.c, the source has compiled too. But from Python, I get this error: File "/usr/local/lib/python2.7/dist-packages/Hamlib.py", line 2533, in send_morse def send_morse(self, *args): return _Hamlib.Rig_send_morse(self, *args) TypeError: in method 'Rig_send_morse', argument 2 of type 'const char *' So, the difference compared to the first example, the const_char_string has modified to const char *, the code has broken same place. How can I resolve that? Thanks: Ervin -- I � UTF-8 |