Sorry for long delay, <br><br>The problem was:<br>I export a class with a std::string field and assinging its string field longer than 15chars crashed my application on one client computer using vista as os.<br><br>I wrote small test case and used previous project configurations to build and it worked&nbsp; (The codes are below the message)<br>
<br>Then I changed my code as small as the test code but still it was not working (what I mean by not working is that application crashed at same code line):<br><br>The only difference with my pyd and test pyd was that test pyd was near the main executable but my pyd was under a directory (module)<br>
<br>I put test pyd file in a directory and an __init__.py file and trying to import it and It also crashed just on the long (&gt;15chars) string assignment line.<br><br>Putting all the pyd s and dlls from the module directory to the main applications directory, and arranging python import statements accordingly solved my problem in a dirty way.<br>
<br>Now the main folder contains too many dlls which is annoying. I still do not know if it is boost-related or just python related. <br>Is space allocation done automatically&nbsp; during std::string assignment?<br><br>When I put pyd file and an __init__.py to a folder and import it from its parent folder it crashes the application. Does the way of memory allocation change if it is in a different folder or next to the main file? <br>
<br>Thanks for your help,<br><br><br><br>Here is the test part:&nbsp; <br><br>a main application embed python<br>a boost python dll module loaded by python script<br>a script called by main application<br><br><br>for&nbsp; TestPython.pyd file:<br>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include &lt;iostream&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include &lt;string&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#include &lt;boost/python.hpp&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">class DataPack</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">{</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">public:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; std::string name;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; void getString(const std::string&amp; str)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;String Parameter: &quot; &lt;&lt; str &lt;&lt; std::endl;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">};</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">using namespace boost::python;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">BOOST_PYTHON_MODULE( TestPython )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{&nbsp;&nbsp;&nbsp; </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; class_&lt;DataPack&gt;(&quot;DataPack&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .def_readwrite(&quot;name&quot;, &amp;DataPack::name)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .def(&quot;getString&quot;,&amp;DataPack::getString);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br>
<br><br>TestApplication:<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include &lt;boost/python.hpp&gt;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">int main(int argc, char **argv)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{&nbsp;&nbsp;&nbsp; </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; Py_Initialize();</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; try {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boost::python::import(&quot;Test&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; &nbsp; catch(boost::python::error_already_set const &amp;) &nbsp; {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PyErr_Print();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; Py_Finalize();</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; return 0;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><br>Test.py file:<br><br><span style="font-family: courier new,monospace;">from TestPython import DataPack</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print &quot;Instance&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">d = DataPack()</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print &quot;Instance string field assignment SHORT&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><a href="http://d.name">d.name</a> = &quot;abc&quot;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print &quot;Instance string field assignment LONG&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><a href="http://d.name">d.name</a> = &quot;123456789012345678901234567890&quot;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print &quot;Instance function call with short string&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">d.getString(&quot;abc&quot;)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print &quot;Instance function call with long string&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">d.getString(&quot;123456789012345678901234567890&quot;)</span><br>
<br><div class="gmail_quote">On Fri, Oct 17, 2008 at 7:17 PM, David Abrahams <span dir="ltr">&lt;<a href="mailto:dave@boostpro.com">dave@boostpro.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c"><br>
on Fri Oct 17 2008, &quot;Furkan Kuru&quot; &lt;furkankuru-AT-gmail.com&gt; wrote:<br>
<br>
&gt; &nbsp; &nbsp; Yes, that seems very likely; this looks a bit like the small string<br>
&gt; &nbsp; &nbsp; optimization gone awry. &nbsp;Perhaps you have mixed the MS runtime lib<br>
&gt; &nbsp; &nbsp; headers with a different version of the binary library.<br>
&gt;<br>
&gt; Is there any way to remove this string optimization. Or How can I trace and find<br>
&gt; these mixed headers to fix the problem?<br>
<br>
</div></div>I don&#39;t know. &nbsp;There are many people in the world much better-qualified<br>
to help you with this problem than I am. &nbsp;I suggest take your question<br>
to a MSVC-specific group. &nbsp;As Stefan said, it&#39;s unlikely that it has<br>
anything to do with boost or python.<br>
<div><div></div><div class="Wj3C7c"><br>
--<br>
Dave Abrahams<br>
BoostPro Computing<br>
<a href="http://www.boostpro.com" target="_blank">http://www.boostpro.com</a><br>
_______________________________________________<br>
Cplusplus-sig mailing list<br>
<a href="mailto:Cplusplus-sig@python.org">Cplusplus-sig@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/cplusplus-sig" target="_blank">http://mail.python.org/mailman/listinfo/cplusplus-sig</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Furkan Kuru<br>