On 05/13/2014 04:59 AM, Sam Tobin-Hochstadt wrote:
On May 13, 2014 3:38 AM, "Konrad Hinsen" <konrad.hin...@fastmail.net <mailto:konrad.hin...@fastmail.net>> wrote: > > Sam Tobin-Hochstadt writes: > > > On Mon, May 12, 2014 at 10:18 AM, Matthias Felleisen > > <matth...@ccs.neu.edu <mailto:matth...@ccs.neu.edu>> wrote: > > > > > >> If the FFI can provide > > >> C-pointer access to something like a flvector, and ensure that it's > > >> not garbage-collected for the duration of a C function call, then a > > >> good interface should be doable. > > > > This is the `f64vector` (or `f32vector`, for single floats) type. > > Docs here: http://docs.racket-lang.org/foreign/homogeneous-vectors.html#%28def._%28%28lib._ffi%2Fvector..rkt%29._make-f64vector%29%29 > > Great, thanks for the pointer! > > Do I understand correctly that an f64vector is a different type from a > flvector? A flarray is based on a flvector, so if f64vector is > different, then I can't have an array based directly on it, and > probably I'll end up having to copy everything again. > Yes, they're different types. I think f64vector has one more indirection, to help with C interoperation, but I'm not sure. Others could say more about this, I'm not an expert in FFI data structures.
I'm not an expert, either, but I'd check out `flvector->cpointer`. That seems to be the right thing to use for C functions that accept a destination array as an argument.
Neil ⊥ ____________________ Racket Users list: http://lists.racket-lang.org/users