[C++-sig] exposing built-in type pointer

Roman Yakovenko roman.yakovenko at gmail.com
Thu Oct 2 11:51:00 CEST 2008


On Wed, Oct 1, 2008 at 1:04 PM, Thomas Rab <thomas.rab at gmail.com> wrote:
> Thomas Rab <thomas.rab <at> gmail.com> writes:
>
>> class foo
>> {
>> public:
>> X x;
>> };
>>
>> bar is actually a typedef for: const unsigned int* bar;
>> Basically I need x to create another object:
>
> made a slight typo. I meant X is a typedef for: const unsigned int*

There are few ways to go:
1. Create thin wrapper around X, which holds x, and use it for
arguments and return type
2. Expose "x" address and use ctypes module
3. Create "more" Pythonic interface for the functionality.

Boost.Python doesn't allow you to pass by pointer\non-const reference
"Python" immutable types.


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list