pointer_list = []
cdef int* foo
pointer_list.append(foo)
cdef int* retrieved_pointer = pointer_list[0]
Is this a sensible thing to do? If so, is it possible?
Cheers,
Henry
pointer_list = []
cdef int* foo
pointer_list.append(foo)
cdef int* retrieved_pointer = pointer_list[0]
Is this a sensible thing to do? If so, is it possible?
Python lists can only hold pointers to PyObject. But, you can use Cython in c++ mode and use a std::vector<int*>.
Thinking out loud: for a Cython/C solution, you could cast those
pointers to uintptr_t (from <inttypes.h>), then store them as Python
integers and later cast them back. That does require a C99 compiler,
so it wouldn't work with MSVC, I believe.
--
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam
You could use Py_intptr_t, or in Python 2 you can use PyLong_FromVoidPointer.