[C++-sig] Problem with Pyste and simple struct
Roman Yakovenko
roman.yakovenko at gmail.com
Sun Sep 30 13:04:35 CEST 2007
On 9/29/07, Thomas Hauk <thauk at novuscom.net> wrote:
>
> Given Foo.h:
>
> struct Foo
> {
> unsigned char data[4];
> };
>
> Pyste produces the following binding:
>
> // Module
> ======================================================================
> BOOST_PYTHON_MODULE(PysteTest)
> {
> class_< Foo >("Foo", init< >())
> .def(init< const Foo& >())
> .def_readwrite("data", &Foo::data)
> ;
> }
>
> When compiled using bjam, produces the following error:
>
> ..\..\boost\1_34_1\boost\python\data_members.hpp(64) : error
> C2440:
> '=' : cannot
> convert from 'const unsigned char [4]' to 'unsigned char [4]'
> There is no context in which this conversion is possible
>
> I've poured through the documentation, tutorials, everything, and I
> haven't found a single example like this.
>
> What is wrong, and how do I fix it?
>
Nothing wrong, Pyste doesn't generate right code.
There are few possible solutions to the problem:
1. To use indexing suite v2:
http://language-binding.net/pyplusplus/documentation/containers.html
2. To use Py++, which will generate code that works:
http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/code_repository/array_1.py?view=markup
--
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/20070930/7f991cc2/attachment.htm>
More information about the Cplusplus-sig
mailing list