By the way

I tried
"resize"ing and "reserve"ing of strings
by

name.resize(1024);
or
name.reserve(1024);

but it did not fix the problem.

It seems that it allows up to 15 chars + null character total 16chars.
I think strings set longer than 15 chars corrupts the stack.

Any help is appreciated.



On Fri, Oct 17, 2008 at 2:10 PM, Furkan Kuru <[EMAIL PROTECTED]> wrote:

> Ok,
>
> class DataPack {
>
> public:
>     std::string name;
> };
>
> BOOST_PYTHON_MODULE( Data)
> {
>         class_<DataPack >("DataPack ")
>                    .def_readwrite("name", &DataPack ::name);
> }
>
>
> in my py file:
>
> d = Data.DataPack()
> d.name = "123456789101234567891012345678910"
>
> It works fine in xp but breaks application down in a vista installed
> computer memory corrupt
> if I set shorter string:  d.name = "123" it is fine for vista too.
> = operator does not work as it does in c++ side, I think.
>
>
>
> On Fri, Oct 17, 2008 at 1:54 PM, Stefan Seefeld <[EMAIL PROTECTED]>wrote:
>
>> Furkan Kuru wrote:
>>
>>> Hello,
>>>
>>> I have exported a struct containing a std::string field and used it one
>>> of my py files.
>>> I used same py and pyd file in another operating system (vista).
>>> It just stuck without giving any errors.
>>> I figured out that the std::string field gets a limited space (as it
>>> should do)
>>> but does not increase it when initialized or assigned with longer
>>> sequence of characters.
>>>
>>> Is it a "quick and good" solution to write a wrapper for std::string and
>>> set its reserved space a high number ( reserve(128); )
>>> or
>>>
>>> export overloaded = operator to python side?
>>>
>>
>> Sorry, but it isn't clear at all what problem you are seeing. Can you
>> provide a concise description of what behavior you expect, and what you
>> actually get (together with a minimal but complete code snippet) ? In that
>> case someone on this list may be able to help you.
>>
>> Thanks,
>>      Stefan
>>
>>
>> --
>>
>>     ...ich hab' noch einen Koffer in Berlin...
>>
>> _______________________________________________
>> Cplusplus-sig mailing list
>> Cplusplus-sig@python.org
>> http://mail.python.org/mailman/listinfo/cplusplus-sig
>>
>
>
>
> --
> Furkan Kuru
>



-- 
Furkan Kuru
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to