From: nerochiaro <ner...@gm...> - 2006-02-10 22:48:54
|
Hi, I'm having a problem where it seems that either me or SWIG is getting a bit confused, and want to understand which one actually is. Probably there's something obvious that i'm missing, but I can't see what i= t is. I have reduced it to the following testcase: -------------- namesp.cxx -------------------- namespace TagLib { class File { public: File() {}; }; class AudioProperties { }; namespace FLAC { class File; class Properties : public AudioProperties { public: Properties(File *file); }; class File { public: File() {}; }; } } --------------- namesp.i ---------------------- %module "namesp" %rename(FLACFile) TagLib::FLAC::File; %{ #include "namesp.cxx" %} %include "namesp.cxx" ------------------------------------------------ Now, i feed this to swig and it doesn't complain: me@mybox:~/$ swig -c++ -ruby -Wall namesp.i But when i feed the generated file to g++, here's the output: me@mybox:~/$ g++ -Wall -I/usr/lib/ruby/1.8/i486-linux -c namesp_wrap.cxx namesp_wrap.cxx: In function 'VALUE _wrap_new_Properties(int, VALUE*, VALUE= )': namesp_wrap.cxx:1634: error: no matching function for call to 'TagLib::FLAC::Properties::Properties(TagLib::File*&)' namesp.cxx:15: note: candidates are: TagLib::FLAC::Properties::Properties(TagLib::FLAC::File*) namesp.cxx:13: note: =20 TagLib::FLAC::Properties::Properties(const TagLib::FLAC::Properties&) Note that g++ doesn't complain against namesp.cxx if i try to feed that file directly to him, so I guess it's valid C++. It seems that it's SWIG gets confused between TagLib::File and TagLib::FLAC::File, because here's the generated wrapper i get (snipped as needed): _wrap_new_Properties(int argc, VALUE *argv, VALUE self) { TagLib::File *arg1 =3D (TagLib::File *) 0 ; TagLib::FLAC::Properties *result =3D 0 ; //... result =3D (TagLib::FLAC::Properties *)new TagLib::FLAC::Properties(arg1)= ; //... } The "strange" thing (at least for me), is that if I remove from the c++ file any mention of the TagLib::AudioProperties base class, then everything works fine. This looks even more weird to me. Is this whole thing a bug or am i doing something wrong and i'm badly confu= sed ? Thanks and sorry for the overly long message. |