From: nerochiaro <ner...@gm...> - 2006-01-18 05:51:40
|
> I see your problem, you are wrapping "primitive" types (int, double, etc)= . > > The SWIG_NewPointerObj/SWIG_TypeQuery methods are needed when you > wrap 'user types', as classes, not primitive types. I have to apologize here. Looking at the code I posted in my previous message I noticed that I had pasted one of the two functions wrong. That function wrapping an int was just a test that i later removed. The true function that causes the problem is the following: SWIGINTERN void TagLib_List_Sl_TagLib_String_Sg__each(TagLib::List<TagLib::String > *self){ =09static swig_type_info *desc =3D SWIG_TypeQuery("TagLib::String" " *"); =09TagLib::List<TagLib::String>::ConstIterator i; =09for (i=3Dself->begin(); i!=3Dself->end(); ++i) =09{ =09=09VALUE x =3D SWIG_NewPointerObj((void *) &(*i), desc, 0); =09=09rb_yield(x); =09} } Which uses a pointer type (TagLib::String), for which I already defined a typemap that looks like this: %typemap(out) TagLib::String { =09if ($1.isNull()) $result =3D Qnil; =09else $result =3D rb_str_new2($1.toCString()); } I will read the rest of your message and try your suggestions later tomorrow as it's quite late here and I sure I will mess something else up if I don't get some sleep. Thanks again and sorry for the mistake. |