Re: [Chicken-users] Basic FFI Principle in Chicken

2013-09-07 Thread Kristian Lein-Mathisen
Hey Chris, I though I'd mention the srfi-4 unit and it's u32vector. This may come in handy for your particular struct. While make-blobs are great for allocating managed memory for arbitrary structs, you can sometimes use make-s32vector, for example, where the struct is basically an array like

Re: [Chicken-users] Basic FFI Principle in Chicken

2013-09-07 Thread Peter Bex
On Sat, Sep 07, 2013 at 12:48:27PM +0200, Kristian Lein-Mathisen wrote: Note that this may not be a good idea if your struct members are just using int because you wouldn't know if it's a s32vector or a s64vector. Also, your foreign-type would go from (pointer (struct color)) to a

Re: [Chicken-users] Basic FFI Principle in Chicken

2013-09-07 Thread John Cowan
Kristian Lein-Mathisen scripsit: Because size of an int can generally be either 32 or 64-bit depending on your architecture, the srfi-4 vectors are possible better suited for floats and doubles where the sizes are all set. It's worth knowing about them though. Actually, there are essentially