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

TP wingusr at gmail.com
Mon Feb 15 22:26:00 CET 2010


On Sun, Feb 14, 2010 at 5:04 PM, Stefan Seefeld <seefeld at sympatico.ca> wrote:
> Yes. Do you have the definition of PIX available ? In that case, you could
> use that via class_<PIX>....

Yes. The entire source of the Leptonica C Image Processing Library is
available at http::/leptonica.com.

Could you give a little more detail please?

The part that confuses me at this point is how to handle parameters of
the form PIX** ppix (Leptonica is FULL of parameters like SOMETYPE**
someParm).

> Otherwise, you may want to create a tiny wrapper class for it, such as
>
> class PIXWrapper
> {
> public:
>  PIXWrapper(I_int32 w, I_int32 h, I_int32 d) : pix_(pixCreate(w, h, d) {}
>  ~PIXWrapper() { pixDestroy(&pix_);}
>  ...
> private:
>  PIX *pix_;
> };

I was hoping to not have to write such wrapper classes. But thank you
for the example. From that I can clearly see how to handle the address
of pointer problem if I decide to take this route.


More information about the Cplusplus-sig mailing list