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 :)

Thanks,
Mohamed.

On Mon, May 11, 2009 at 9:51 PM, Mohamed Lrhazi <[email protected]> wrote:
> Hello,
>
> Is it possible in Cython to pass a void pointer to a python function,
> then have the latter send it back as a parameter to a  function
> defined in Cython, then be able to reuse it?
>
> Basically, I am using a C lib that sends back these pointers, pointing
> to structures whose definitions in the header file are
> undefined/incomplete. I would like to send them as is to Python, but
> then be able to recover them back and resend them to lib.
>
> I can keep them in Cython as global variables, but was wondering if I
> could transparently pass them back and forth instead.
>
> I thought maybe I could pass the actual address, as in: <size_t>&pointer[0]
>
> but could not figure out how to make a new pointer in Cython assigning
> the recovered address to it.
>
> Thanks a lot,
> Mohamed.
>



-- 
" Logic merely sanctions the conquests of the intuition."
Jacques Hadamard
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to