[C++-sig] Pointer ownership
roman.yakovenko at gmail.com
Tue Aug 7 07:30:25 CEST 2007
On 8/6/07, Tim Spens <t_spens at yahoo.com> wrote:
> I have a constructor that takes a pointer as an
> argument. When I create an instance of this class and
> the object looses scope in python I get an error
> glibc detected python: free(): invalid pointer:
> The class wrapper looks like this
> class_<z_command, bases<command>,
> boost::noncopyable>("z_command", init<std::string
> const &, p *>());
> Do I need a call policy for this pointer? I've looked
> at the boost python call policies and found nothing
> for constructors with pointers as arguments.
The description of the problem is not clear. You should be a little
bit descriptive about p* lifetime and management.
http://boost.org/libs/python/doc/v2/init.html - here you will find how
to specify call policies for "init".
C++ Python language binding
More information about the Cplusplus-sig