Hi, I updated my boost libraries last week (via CVS on the 06/02) and I'm now experiencing problems when calling functions with wstring arguments, which worked seamlessly with my previous boost libs, using python 2.4. I may be missing something obvious, did anything change concerning wstring support (I was previously using a CVS snapshot around v1.31 of boost) for instance, I have a class BrushTextMenu::Entry defined roughly as follows :: class BrushTextMenu : public ... { public: struct Entry { Entry() {}; explicit Entry(std::wstring const& _text) : text(_text) {}; std::wstring text; }; which is wrapped as follows :: python::class_<BrushTextMenu, bases<Brush>, Brush_Holder<BrushTextMenu>::type, boost::noncopyable> class_BrushTextMenu("BrushTextMenu", no_init); { python::scope class_scope = class_BrushTextMenu; python::class_<BrushTextMenu::Entry>("Entry") .def( init<std::wstring const&>() ) ; } now, whenever I call the Entry constructor, I get error messages concerning signature mismatch :: b = BrushTextMenu.Entry(u"r") ==> Traceback (most recent call last): File "<string>", line 1, in ? Boost.Python.ArgumentError: Python argument types in Entry.__init__(Entry, unicode) did not match C++ signature: __init__(struct _object *, class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >) __init__(struct _object *) or b = BrushTextMenu.Entry("r") ==> Traceback (most recent call last): File "<string>", line 1, in ? Boost.Python.ArgumentError: Python argument types in Entry.__init__(Entry, str) did not match C++ signature: __init__(struct _object *, class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >) __init__(struct _object *) Thanks in advance, Nicolas.
Hm, obsiouvly I missed something obvious ... :} For the records, the problem was that I compiled boost.python lib with BJam (which I did not do before) with vc-7_1 toolset, and BJam activates the VC 'treat wchar_t as Build-in Type' (/Zc:wchar_t) whereas my extension modules were not using this option. Hence, the registered builtin type converter was refering to std::wstring as std::basic_string<wchar_t, ...> and my module to std::basic_string<unsigned short, ...> So one have to make sure that the boost.python lib and his modules are consistent in wchar_t compilation... Sorry for the time lost, Regards, Nicolas.
participants (1)
-
Nicolas Lelong