On 02/14/2010 07:32 PM, TP 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?
Yes. Do you have the definition of PIX available ? In that case, you
could use that via class_<PIX>....
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_;
};
and then use that in the way described in the docs.
HTH,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig