[racket] Blog post about Racket

From: Neil Toronto (neil.toronto at gmail.com)
Date: Tue May 13 10:51:15 EDT 2014

On 05/13/2014 04:59 AM, Sam Tobin-Hochstadt wrote:
>
> On May 13, 2014 3:38 AM, "Konrad Hinsen" <konrad.hinsen at fastmail.net
> <mailto:konrad.hinsen at fastmail.net>> wrote:
>  >
>  > Sam Tobin-Hochstadt writes:
>  >
>  >  > On Mon, May 12, 2014 at 10:18 AM, Matthias Felleisen
>  >  > <matthias at ccs.neu.edu <mailto:matthias at 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 ⊥


Posted on the users mailing list.