Threading a lengthy C function

Leo Breebaart leo at
Tue Nov 25 10:51:07 CET 2003

My thanks to everyone who participated in this, ahem, thread.
Your responses have been very helpful -- this newsgroup is a
wonderful resource for the beginning Python programmer.

Duncan Booth <duncan at> writes:

> It may be easiest simply to wrap the library function in another C function 
> that does this, and then use SWIG to wrap the new function instead of the 
> original. e.g.
> #include <python.h>
> int safe_thefunction(char *arg, int arg2)
> {
>    int res;
>    res = thefunction(arg, arg2);
>    return res;
> }

This is more or less exactly what I ended up doing, and
everything works like a charm now.

Leo Breebaart  <leo at>

More information about the Python-list mailing list