[python] Function with const wchar_t* arguments/return values

[Boost.Python] Anybody have a suggestion for the best way to expose a class's member function that accepts const wchar_t* as an argument, or returns a const wchar_t*? I'm trying to find a way to do it that does not involve writing a thin wrapper function around each of my member functions that convert to/from std:wstring or something. If it balloons up into 100 functions that interact with const wchar_t*, that's a pretty big handful of tiny wrapper functions. I apologize if this is a dumb question, but I haven't found any useful info. It all works implicitly for const char*. Any ideas? Thanks, Dan Fike

on Thu May 08 2008, "Dan Fike"
[Boost.Python]
Anybody have a suggestion for the best way to expose a class's member function that accepts const wchar_t* as an argument, or returns a const wchar_t*?
I'm trying to find a way to do it that does not involve writing a thin wrapper function around each of my member functions that convert to/from std:wstring or something. If it balloons up into 100 functions that interact with const wchar_t*, that's a pretty big handful of tiny wrapper functions.
I apologize if this is a dumb question, but I haven't found any useful info. It all works implicitly for const char*.
Any ideas?
Dan, First, see http://www.boost.org/community/groups.html#cplussig Next, you'll want to write a custom type converter. I'm sorry that it isn't documented much. You can read https://realityforge.vrsource.org/view/PyOpenSG/HowBoostPythonWorks#Converti... which will teach you quite a lot but you might be better off asking on the mailing list mentioned above if you just want a quick answer. HTH, -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Anybody have a suggestion for the best way to expose a class's member function that accepts const wchar_t* as an argument, or returns a const wchar_t*?
First, see http://www.boost.org/community/groups.html#cplussig
Ah, I guess I missed that before.
Next, you'll want to write a custom type converter. I'm sorry that it isn't documented much. You can read https://realityforge.vrsource.org/view/PyOpenSG/HowBoostPythonWorks#Converti... which will teach you quite a lot but you might be better off asking on the mailing list mentioned above if you just want a quick answer.
I'll double-ceck those docs and try again, and maybe post a query in comp.python.c++. Thanks! Dan
participants (2)
-
Dan Fike
-
David Abrahams