On May 11, 2009, at 7:25 PM, Lisandro Dalcin wrote: > On Mon, May 11, 2009 at 11:13 PM, Mohamed Lrhazi <[email protected]> > wrote: >> It seems I can make it work passing the address as >> <size_t>&pointer[0], then recovering t as: >> >> cdef void *new_pointer = <void*><size_t>recovered_value >> >> Is this correct? or is it just luck that my program is not >> crashing yet :) >> > > It is correct as long as you pass back the "correct" integer value... > If you ever make a mistake, you will likely have a segfault... > > Depending on your original C API, you could consider designing an more > object oriented, pythonic API where your pointers are (cdef) > attributes of a (cdef) class, and their methods provide access to the > many function calls of the lib you are wrapping...
See also http://docs.python.org/c-api/cobject.html which is made for this kind of thing. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
