Dear sage-devel,

I have a question related to void pointers in Cython. I am wrapping a C++ 
library that has a function that accepts a function pointer and each time 
it processes something it calls the passed function. The function being 
passed is defined as

void hook(void *user_param , unsigned int n, const unsigned int *aut).

n, aut is the data computed by the library while user_param is anything the 
user wishes to pass to the function being called.

Now, in my scenario it would be really nice if user_param could point to a 
tuple containing a dict and a list. Hence my question is:

Is there a way in Cython to obtain the address of a Python data structure  
and later on for this address to be casted to the corresponding Python type?

The alternative that I am currently using is to ignore user_param 
completely and keep some global data structures to store the results being 
passed to hook. I am not sure if this is less ugly than passing a void 
pointer and casting or not.

Best,

Jernej

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to