[C++-sig] wchar_t bindings for Boost.Python

Eric Ries ericries at speakeasy.net
Fri Apr 2 22:44:25 CEST 2004

David Abrahams suggested that I post my message below here, which I mistakenly sent directly to him originally. I am happy to provide source code if there is interest; let me know.



-----Original Message-----
From: David Abrahams [mailto:dave at boost-consulting.com]
Sent: Friday, April 2, 2004 08:31 PM
To: 'Eric Ries'
Subject: Re: [C++-sig] Re: Boost.Python problems

"Eric Ries" <ericries at speakeasy.net> writes:

> Hello,
> I am a brand new Boost.Python user, and I am very impressed. So first
> off, thanks for the awesome work that has gone into Boost.Python and
> Boost generally.

Glad you like it!

> I have been using Pyste to generate Boost.Python bindings for C++, and
> noticed that there is not automatic support for wchar_t -> py unicode
> conversions for C++ functions that return that type.
> While searching for a solution, I came across an email of yours
> (http://mail.python.org/pipermail/c++-sig/2003-March/003633.html) in
> which you wrote:
>>> 4. There are no converters for std::wstring or wchar_t.
>>Good point.  Care to contribute some?
> So I figured I would give it a try. I was pleasantly surprised by how
> easy it was. That probably means that either 1) you guys have already
> done this on your development branch (I am on a vanilla 1.31.0 intall)
> or 2) my solution was easy because it does not generalize to other
> compilers.
> But, on the off chance that it might be useful to you, I wanted to
> write and see if you would like me to send in a patch. I modified
> Pyste as well as several boost.python hpp files. I have only tested on
> MSVC6.

First, please in the future always post things like this on the
C++-sig.  There are other people there who ought to see your post too.
We already have wstring converters, but you could contribute
converters for wchar_t and I'd be happy to have them.  I don't know
why you'd have to change Pyste, but that's not my department (another
reason to post on the C++-sig).


Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list