[C++-sig] How to manage smart pointer as return value of a factory?

David Abrahams dave at boost-consulting.com
Thu Feb 16 13:29:04 CET 2006


Julien <swell at netcourrier.com> writes:

> David Abrahams <dave <at> boost-consulting.com> writes:
>> 
>> All you should need is
>> 
>>   boost::python::register_ptr_to_python<std::auto_ptr<X> >();
>> 
>> And *nothing* else.
>> 
>> http://www.boost.org/libs/python/doc/v2/register_ptr_to_python.html
>> 
>> HTH,
>
> Ok , i reverted my code to test this and have a new pb now , the python code 
> throw an exception telling "RuntimeError: Bad read pointer - no RTTI data!" 
> when i try to create an object from the factory "y =
> hello.FactY.create()". 

It looks like some kind of message from your C++ compiler's runtime
library.

One possibility is that your compiler has C++'s RTTI feature disabled by
default (e.g. MSVC) and you're not using Boost.Build to build all your
code like the Boost.Python instructions suggest.  I can't think of any
other explanations right now.  

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list