[C++-sig] Foo to FooWrapper

Roman Yakovenko roman.yakovenko at gmail.com
Tue Mar 27 18:44:44 CEST 2007


On 3/27/07, Piotr Jaroszynski <p.jaroszynski at gmail.com> wrote:
>
> Hello,
>
> I suppose the code will show my problem better then myself, so:
> http://dev.gentooexperimental.org/~peper/boost/test.cc
> $ g++ -fPIC -shared -lboost_python -I/usr/include/python2.4 test.cc -o
> test.so
>
> and in python:
>
> >>> import test
> >>> test.getFoo().blah()
> 0
> >>> test.getFoo().blah1()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> Boost.Python.ArgumentError: Python argument types in
>     Foo.blah1(Foo)
> did not match C++ signature:
>     blah1(FooWrapper {lvalue})
>
> How can I fix that? Making a copy-ctor for Foo is a no option. I thought
> about
> using shared_ptr<Foo> copy-ctor but how?
>
>
Make blah1 to be static function, which take reference to Foo class. this
should solve the problem

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070327/7405453c/attachment.htm>


More information about the Cplusplus-sig mailing list