Re: [pygccxml-commit] string type mismatch between python and C++
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2008-04-07 06:21:20
|
On Mon, Apr 7, 2008 at 9:00 AM, Johnson Lu <joh...@op...> wrote: > Hi: > > I am extending an embedded python using PY++ (a great product, along with > Boost, IMHO), Thanks > my problem is that the C++ function being called from Python > takes a (wstring) or wchar argument, but the corresponding function > signature assigned to Python seems to take a regular str. So when I try to > make a call I get… > > > > ClassificationOutput.setApplicationName(ClassificationOutput, str) > > did not match C++ signature: > > setApplicationName(struct ClassificationOutput_wrapper {lvalue}, class > std::basic_string<unsigne > > d short,struct std::char_traits<unsigned short>,class > std::allocator<unsigned short> > applicationNa > > me) > > setApplicationName(class ClassificationOutput {lvalue}, class > std::basic_string<unsigned short,s > > truct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > applicationName) > > > > And obviously that doesn't work. The funny thing is while python can't pass > a string into C++, C++ can pass that wchar to Python just fine. This > simple string exchange seems such common place that it must have been solved > multiple times before, but I just can't get a handle on how to deal with it. Can you post small C++ and & Python code that reproduce the problem. Also what compiler/STL do you use? Another question: why your string is defined using unsigned short, instead of wchar_t? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |