[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] C_alloc OK before C_invoke? (was Re: Constructing parame
From: |
Daniel B. Faken |
Subject: |
[Chicken-users] C_alloc OK before C_invoke? (was Re: Constructing parameter lists in C) |
Date: |
Thu, 21 Jul 2005 11:51:35 -0400 (EDT) |
On Thu, 21 Jul 2005, Daniel B. Faken wrote:
>
[....]
>
> Now a preferable solution would be to construct the parameter list,
> as a C_word (scheme-object) via C_list(...), and either
> * use C_callback(scmfn, arglist) for callbacks or
> * use a single entry-point 'scm_applyfn' that takes two
> scheme-object args and just calls (apply scmfn arglist).
On a related note: is it OK to call C_alloc() to construct data to be
passed via CHICKEN_invoke()?
The manual entry for C_alloc() says "..Note that stack-allocated data
objects have to be passed to Scheme callback functions... This is really
only usable for callback procedure invokations, make sure not to use it in
normal code..."
- but I'm not sure if the point is to not re-use C_alloc() memory or if
this really means 'only proper callbacks' i.e. after entering scheme.
The C_parameter type taken by CHICKEN_invoke() has a C_word/scheme-object
field, which would seem to indicate there is some way to pass general
scheme-objects..
If NOT with C_alloc(), then how would one construct a non-immediate
object? (e.g. where would the first arg to C_list() come from?)
Thanks again!
cheers,
Daniel