Cpointer -> flvector?

Once I have a pointer to a memory block from the ffi (allocated in a shared memory space), is there a way to turn it into a standard racket flvector? I see there's a flvector->cpointer, but not the converse.

Probably not, for the reasons discussed here:

Ouch, that's not very promising indeed :confused: Thanks!

You might be able to use _f64vector from ffi/vector, though!

True, but that won't help me much.

The idea was to re-use all my functions defined for flvectors without having to duplicate the work and change all the flvector-ref, etc. while still making it work also for flvectors.

Also, _f64vector uses _double*, which is slower than _double AFAIR.

A possible solution:
Instead of trying to make my-shared-flvector behave like flvector, I can do exactly the converse since I can obtain the cpointer from flvector.

I still need to modify my functions to work with my-shared-flvector, but at least it will work seamlessly for standard flvectors too.

Can this defeat some compiler optimizations though?