[C++-sig] Re: what happened with this std::string parameter in boost.python
Holger Duerer
H.Duerer at gmx.net
Mon Apr 4 18:07:57 CEST 2005
>>>>> "kalin" == kalin <kalin.eh at gmail.com> writes:
kalin> David Abrahams wrote:
>> Donnie Leen wrote:
>>
>>> I made a program embedding boost.python, writting a module as following:
>>>
>>> void write( std::string s )
>>> {
>>> // do nothing
>>> }
>>> BOOST_PYTHON_MODULE(mym)
>>> {
>>> def( "write", &write );
>>> }
>>>
>>>
>>> I run the python code:
>>> import mym
>>> s = 'hello'
>>> mym.write(s)
>>>
>>> it runs ok, but if i run the python code as following:
>>> import mym
>>> s = int.__doc__
>>> mym.write(s)
>>>
>>> it crashed
>> What do you mean by "crashed?" Are you sure it didn't throw an
>> exception that was never caught?
>>
[...]
Is this under Windows? We had problems like that -- short string (<16
bytes?) work, long strings cause a crash. We traced this to multiple
versions of the C++ runtime library. Are you linking the runtime
library statically?
Holger
More information about the Cplusplus-sig
mailing list