On Sun, Dec 12, 2010 at 3:04 PM, Jim Bosch <tallji...@gmail.com> wrote:

> I think you'll want to define a custom wrapper class for each of these
> typedefs with a distinct type.  From your example, it looks like many of
> these might be similar enough that you could use a template:
>
> [snip]

>
> Now, for all the other (non-constructor/destructor) functions that take
> these, you'll need to write a function wrapper that takes arguments by the
> wrapper classes, calls the C function, and returns using the wrapper classes
> (you'll have to think about ownership semantics in that case, of course).
>  Then you can use Boost.Python to wrap the wrapper functions.
>
 [snip]

>
> Finally, I wouldn't normally recommend SWIG, because I think Boost.Python
> is generally much better, especially for wrapping C++ code.  But in this
> case, since you're wrapping pure C using a lot of opaque pointers, SWIG's
> approach might be a better fit, since its code generation naturally
> considers everything an opaque pointer.  If you don't have to use
> Boost.Python for other reasons, it might be worth a look, at least.
>
>
Thanks Jim!  I kind of expected that I would need to do wrapper classes and
functions, but was hoping it wouldn't quite come to that. I Niall's patch
doesn't work out well, I might just do this. As for SWIG, I considered it,
but chose Boost for the sake of learning a bit more about it. Maybe it would
be wise to just scrap it and go with SWIG though.

- Jacob
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to