Subject: [ruby-ffi] Ruby Array Pointer |
From: v01d |
Date: 6/8/10 5:25 PM |
To: ruby-ffi |
Hi, is it possible to pass a C function the data pointer to a Ruby array? I have a Matrix class, and I wish to write a "to_a" method which will produce an array of arrays. I've tried several ways and tested the performance but it seems really slow, and I think it would be better to just attach a C function that would take the pointer to the destination array and the pointer to the input data contained in the matrix (this second part is no problem). Is this possible? Or I have to resort to writing a C function that accesses the array using RARRAY_PTR and such? Thanks, Matt