[C++-sig] Custom smart pointer and bp::wrapper
Roman Yakovenko
roman.yakovenko at gmail.com
Sat Jan 17 20:15:12 CET 2009
2009/1/17 Paul Melis <pyplusplus at assumetheposition.nl>:
> But when trying to run
>
> import doh
>
> class MyCallback(doh.Callback):
> def execute(self, t):
> print t
> return 1
>
> m = MyCallback()
>
> t = doh.Thing()
> t.setCallback(m)
> t.update()
>
> i'm getting
>
> Traceback (most recent call last):
> File "no_to_python_converter.py", line 12, in <module>
> t.update()
> TypeError: No to_python (by-value) converter found for C++ type: Thing".
>
> And I fail to see why...
Mu guess: you need to use boost::python::register_ptr_to_python< Thin >();
( http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/register_ptr_to_python.html
)
I have more or less complete example, which exports custom pointer
class and its usage to Python:
http://www.language-binding.net/pyplusplus/troubleshooting_guide/smart_ptrs/smart_ptrs.html
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list