[C++-sig] [Boost.Python] Wrapping C library functions

Roman Yakovenko roman.yakovenko at gmail.com
Mon Feb 15 06:31:43 CET 2010


On Mon, Feb 15, 2010 at 2:32 AM, TP <wingusr at gmail.com> wrote:
> Suppose I am attempting to use a C (not C++) library that has an .h file
> with things like this:
>
>  extern PIX * pixCreate ( l_int32 width, l_int32 height, l_int32 depth );
>  extern void pixDestroy ( PIX **ppix );
>
>  extern PIX * pixClone ( PIX *pixs );
>  extern PIX * pixCopy ( PIX *pixd, PIX *pixs );
>
> Is it possible to use Boost.Python to wrap such functions?

Definitely, but the price will be too high.

If the library coded in "C" only than you can use ctypes module to
access the functionality. You will get pure-Python solution.
There are even few code generators out there, that will happily
generate initial ctypes code for you.

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


More information about the Cplusplus-sig mailing list