Petter Egesund wrote:
Hi, I wonder:
Is there a way to "cast" a u32vector to a u8vector (except for creating a new one and writing to this)?
The reason I would like to do this is that u8vectors seems to be the fastest way to write to disk; read-subu8vector and write-subu8vector.
http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Namespaces#Access_to_G...
##write-subu8vector
Of course the byte order in the file will be cpu endianness dependent.
Re-tagging vectors to be of different type is also possible using lowlevel ops, but why not go with the above.
I could off course do this in C using the FFI, but I am not sure if the garbage-collector might suprise me if I tried this?
Currently not for the time span during which you don't leave C. Be prepared for possible changes with future Gambit versions then, though.
Is there a canonical way?
Currently the only canonical way would be to use the ffi with buffers allocated in C.
Christian.