[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] FFI question
From: |
Peter Keller |
Subject: |
[Chicken-users] FFI question |
Date: |
Fri, 16 Aug 2002 00:50:46 -0500 |
User-agent: |
Mutt/1.2i |
Hello,
I want to implement an FFI to a C function that returns a pointer to a
static structure.
So, let's say the C function is this:
struct foo
{
int x;
float y;
size_t z[3];
};
foo* foo_func(void)
{
static foo f;
f.x = 10;
f.y = 20;
f.z[0] = 30;
f.z[1] = 40;
f.z[2] = 50;
return &f;
}
How would I write an FFI to foo_func so that the returns structure pointer
can be accessed nicely. I suspect I'm going to have to do something like
this:
>>> (foo_func)
(10 20 (30 40 50))
But is there a better way where I might be able to use define-record?
Thanks.
-pete
P.S. If the structure returned was dynamic, I suspect I'll have to use
the set_finalizer! trick I was already taught for the GNU MP interface?
- [Chicken-users] FFI question,
Peter Keller <=