I have to call from python a C macro which uses as an input a pointer which is used as a list in c.
When I try to call it with a float list argument, I get a “could not convert argument 1” error.
C code :
float myMacro(*float myList)
{return myList[1]}
Python code:
Import the macro as r.myMacro using LoadMacro
Define my_list a list of python or numpy floats (both fail)
r.myMacro(my_list)
Output :
TypeError: float* myList -> could not convert argument 1
I also tried with a tuple and it failed.
Thanks in advance for your help
Did you try it with an array that is specifically a float32 array? Because otherwise it becomes a float64 on my machine, which would be a double in C++:
>>> import numpy as np
>>> x = np.array([1., 2., 3. ])
>>> x.dtype
dtype('float64')
>>> y = np.array([1., 2., 3. ], dtype='float32')
>>> y.dtype
dtype('float32')