I am writing a function that constructs a malloc\'d unsigned char * array, and then retuns the pointer. In pure Cython or C, this is easy. All you have to do is
You can cast a pointer to the appropriate C type, which should then be translated into a Python integer by Cython. The correct C type is uintptr_t from <stddef.h> which in Cython would be available via from libc.stdint cimport uintptr_t. The cast is of course written <uintptr_t>array_or_pointer.