From: <Mal...@dl...> - 2011-02-28 14:08:37
|
Hello, I have a question about passing arrays created in python to C via the SWIG interface. In C I have a function that looks like this: void set_arrayt(int *noElements, void *myArray) Now i would like to create a numpy-array in python and call this function. Thanks to the cpointer functions of swig i am able to create a int_pointer that i can use for the noElements parameter: #mymodule.i %include cpointer.i %pointer_functions(int, intp); # Python noElements = mymodule.new_intp() mymodule.intp_assign(noElelemts,100) However, i dont have an idea how to "convert" a numpy array like myArray = np.ones((10,10)) to a void pointer so that I can pass it as a parameter to the set_array function. I hope you can help me and thank you in advance! Malte |