[C++-sig] Re: Tedious Newbie Question

Gareth Simpson g.simpson at zoo-tech.com
Tue Jun 8 13:11:27 CEST 2004


> 
> > I am trying to use Boost.Python to embed a Python library 
> into my C++
> > application.  The library in question uses unicode strings 
> internally and I
> > can't for the life of me work out how to get them out and 
> into my C++.
> > Google is largely silent on the matter.
> >
> > I have no problem using extract<> to get a python string 
> into a std::string
> > but trying the same thing with unicode python strings and 
> std::wstrings
> > throws an exception.
> >
> > Clearly I'm going about it the wrong way - what should I be doing?
> 
> Probably you need to be using a newer version of Boost; we've
> supported wstring conversions since Boost 1.31.0.


That's the version of boost I have.

It looks like it's trying to delete something it shouldn't (access
violation) somewhere in the bowels of the STL / boost::python

Interestingly if I go up the call stack to where the extract<std::wstring>()
is being called, the unicode string has actually arrived.


> 
> But we don't support Py_Finalize(); see
> http://www.boost.org/libs/python/todo.html#pyfinalize-safety
> 


Ah, what should I do instead?




More information about the Cplusplus-sig mailing list