Fiddle - Pass pointer to function


In FFI to pass a pointer to a C function I would do something like:

arr = [1.0, 2.0, 3.0]
vec_pointer =, arr.size)
vec_pointer.put_array_of_double(0, arr)

How do I do the same using Fiddle?

I have tried the following with no success

s =[‘add_vector’], [Fiddle::TYPE_VOIDP,
Fiddle::TYPE_INT], Fiddle::TYPE_DOUBLE)
a = [1.0, 2.0, 3.0]
arr_ptr_int = a.object_id << 1
arr_ptr = arr_ptr_int, 3 * Fiddle::SIZEOF_FLOAT

The C function is called, but the content of the array(pointer) is just
random number and I guess this means that I am passing the wrong


Just in case this could help someone, the way to pass an array pointer

arr = [1.0, 2.0, 3.0]
ptr = Fiddle::Pointer[arr.pack(‘E*’)]

The E3 is for little endian byte order