[C++-sig] Exposing a C-style array data member to Python via Boost.Python

Ashish Sadanandan ashish.sadanandan at gmail.com
Fri Jul 26 23:16:21 CEST 2013


Ashish Sadanandan <ashish.sadanandan <at> gmail.com> writes:

> 
> I have a struct that contains a C-style array data member. I'd like to have
> this struct exposed to Python, and this data member be accessible as a tuple
> in Python.
> 
> struct S
> {
>   char arr[10];
> };
> 
> 
> So the question is, how can I expose that C-style array data member to
> Python as a tuple?
> 

I screwed up the question. I actually need a list, not a tuple, since it
needs to be modifiable on the Python side. The rest of the question remains
the same; except I should also mention that the array in question is 4128
chars long, not just 10. So copying it is not as trivial as the question
first implies.




More information about the Cplusplus-sig mailing list