Closed davidbrochart closed 3 years ago
Is it possible to pass a pointer to a C jitted function from Python? I tried naively with this C function signature:
void x(double* ptr);
but I get an error in Python:
m.x(94557793454592) # ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_double instance instead of int
I also tried to write the pointer directly in the C code:
void x() { double* ptr = 94557793454592; }
but I get this error:
m.x() # error: 'I' format requires 0 <= number <= 4294967295
The pointer has to be passed from Python using ctypes, e.g.:
ctypes
import ctypes a = ctypes.c_double() ptr = ctypes.pointer(a) m.x(ptr)
Thanks @windelbouwman for the help!
Is it possible to pass a pointer to a C jitted function from Python? I tried naively with this C function signature:
but I get an error in Python:
I also tried to write the pointer directly in the C code:
but I get this error: