No, I compiled boost.python with just ' --with-python '.<br><br>and I just made a last try to change the 'shared_ptr<A> const& ' to 'shared_ptr<A>&',<br>and things suddenly become right. ^_^<br>
well I don't quite understand what's going on inside though. maybe 'shared_ptr<A> const&' made temp copy (?)<br>----------------------------------------------------------------------------<br>struct A<br>
{<br>
A()<br>
{<br>
cerr << "Creating A" << endl;<br>
}<br>
};<br>
<br>
class B<br>
{<br>
private:<br>
// shared_ptr<A> const& m_ptr; //remove const<br> shared_ptr<A> & m_ptr<br>
public:<br>
//B(shared_ptr<A> const& ptr):m_ptr(ptr)<br> B(shared_ptr<A> & ptr) : m_ptr(ptr)<br>
{<br>
cerr << "Creating B" << endl;<br>
cerr << m_ptr.get() << endl;<br>
}<br>
<br>
void ShowPtr() const<br>
{<br>
<div class="im"> cout << m_ptr.get() << endl;<br>
}<br>
</div>};<br>
<br>
BOOST_PYTHON_MODULE(TryIt)<br>
{<br>
<br>
// class_<B, auto_ptr<B> >("B", init<shared_ptr<A> const&>())<br> class_<B, auto_ptr<B> >("B", init<shared_ptr<A> &() )<br>
.def("ShowPtr", &B::ShowPtr);<br>
<br>
class_<A, shared_ptr&lt;A>, noncopyable >("A");<br>
}<br>
----------------------------------------------------<br><div id=":uz" class="ii gt">
from TryIt import *<br>
a = A() # Creating A<br>
b = B(a) # Creating B, 0xABCDE<br>
b.ShowPtr() # 0xABCDE</div><br><br><div class="gmail_quote">On Fri, Mar 13, 2009 at 5:57 AM, David Abrahams <span dir="ltr"><<a href="mailto:dave@boostpro.com">dave@boostpro.com</a>></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 class="im"><br>
on Thu Mar 12 2009, ZaeX <zaexage-AT-gmail.com> wrote:<br>
<br>
> I just built the boost.python 1.36 with Python2.6.1 and tried again, and it<br>
> still turned out to be 0xcccccccc in debug build.<br>
<br>
</div>Have you read<br>
<a href="http://www.boost.org/doc/libs/1_38_0/libs/python/doc/building.html#python-debugging-builds" target="_blank">http://www.boost.org/doc/libs/1_38_0/libs/python/doc/building.html#python-debugging-builds</a><br>
?<br>
<font color="#888888"><br>
--<br>
Dave Abrahams<br>
BoostPro Computing<br>
<a href="http://www.boostpro.com" target="_blank">http://www.boostpro.com</a><br>
</font><div><div></div><div class="h5">_______________________________________________<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>Time is mana, we must hurry<br>