Ah, ctypes

Nick Craig-Wood nick at craig-wood.com
Mon Jun 1 17:29:44 EDT 2009

David Bolen <db3l.net at gmail.com> wrote:
>  Nick Craig-Wood <nick at craig-wood.com> writes:
> > ctypes could potentially note that function types don't have enough
> > references to them when passed in as arguments to C functions?  It
> > might slow it down microscopically but it would fix this problem.
>  Except that ctypes can't know the lifetime needed for the callbacks.  If
>  the callbacks are only used while the called function is executing (say,
>  perhaps for a progress indicator or internal completion callback) then
>  it's safe to create the function wrapper just within the function
>  call.

Good point...  However I wouldn't mind if ctypes emitted a warning or
even threw an exception in this case too though as the other case is
so invidious.

Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick

More information about the Python-list mailing list