[C++-sig] Conversion problem

Roman Yakovenko roman.yakovenko at gmail.com
Wed Jan 13 11:44:50 CET 2010


On Wed, Jan 13, 2010 at 11:00 AM, Simon Pickles
<sipickles at googlemail.com> wrote:
> Hello,
>
> I wonder if someone could help me with a tricky conversion between c++ and
> python types (well, tricky for me!)
>
> I have a c++ library that I would like to use in python via Boost::Python
>
> One function fills a c++ unsigned char* buffer. It has two overloads:
>
>       unsigned char * getPixels(int deviceID);
>       bool getPixels(int id, unsigned char * pixels);
>

In both cases the easiest solution would be create small wrappers
around the functions:

std::string getPixels(int i ){ ... }

and expose it.

Another solution would be to use ctypes module to call those functions.

In both cases Py++ can help you:
http://language-binding.net/pyplusplus/documentation/functions/transformation/transformation.html

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


More information about the Cplusplus-sig mailing list