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

TP wingusr at gmail.com
Mon Feb 15 22:50:17 CET 2010


On Sun, Feb 14, 2010 at 9:31 PM, Roman Yakovenko
<roman.yakovenko at gmail.com> wrote:
> 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/
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>

Thank you for your response. ctypes was on my list of options to
investigate. I wonder if you know if it will be able to handle
parameters like PIX** ppix?

A generator would be nice, as the Leptonica Image Processing Library
is quite large (although my initial plans are to do as few functions
as possible, just to see what's involved in making this work).


More information about the Cplusplus-sig mailing list