On 09.09.2013 00:07, Kristian Lein-Mathisen wrote:
Ah, of course, John! I got them mixed up.
In that case Chris, I think your color struct might fit quite nicely
into a make-s32vector. I did not test the code below, but something like
it might work:
(define-foreign-type color* s32vector
Ah, of course, John! I got them mixed up.
In that case Chris, I think your color struct might fit quite nicely into a
make-s32vector. I did not test the code below, but something like it might
work:
(define-foreign-type color* s32vector
(lambda (a) (assert (= 4 (s32vector-length a))) a))
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
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
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
On Fri, Sep 06, 2013 at 08:52:08AM +0200, Chris Mueller wrote:
Hi,
Hi!
i've currently started experimenting with the FFI interface provided by
the chicken compiler and have some principle questions about its common
usage.
Sure, no problem. One important thing to remember is that there
On 06.09.2013 09:07, Peter Bex wrote:
On Fri, Sep 06, 2013 at 08:52:08AM +0200, Chris Mueller wrote:
Hope its not too basic for you. :)
Never, user questions are what this mailing list is for! I hope my
answers make a little sense.
Definitely! This is very helpful. I will immediately check
Hi,
i've currently started experimenting with the FFI interface provided by
the chicken compiler and have some principle questions about its common
usage.
Assume the given C Code:
struct color {
int red;
int green;
int blue;
int alpha;
};
struct color* alloc_new_color(int red, int