Subject: [ruby-ffi] Array of Ints |
From: John Lee |
Date: 10/25/11 3:51 PM |
To: ruby-ffi |
I am using Ruby 192 I have the following c function: int function1(int *dataArray, int value1 , int value2) The first argument is an array of ints Here is my FFI code: attach_function :function1, [:pointer, :int, :int], :int ruby_array = FFI::MemoryPointer.new(:int,4) ruby_array.write_array_of_int(1000,2000,3000,4000]) ... function1(ruby_array, 1, 2) But that produces an error message that function1 is an undefined method. I've tried to find documentation that explains how array works, but is unable to. How would arrays of ints be implemented?