On 7/21/05, Daniel B. Faken <[EMAIL PROTECTED]> wrote: > > On a related note: is it OK to call C_alloc() to construct data to be > passed via CHICKEN_invoke()?
Yes, that should work. > 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. What this means is that the storage used for the Scheme data may not be popped from the stack if it hasn't been copied/gc'd into the major heap yet. This may happen if you C_alloc in normal C procedures (which subsequently return). CHICKEN_invoke runs in proper CPS mode, and allocates merrily on the stack, so passing stack-allocated data to it should be fine. > > 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?) You could pass Scheme data to CHICKEN_invoke, that has previously been created from a different invocation of it. But as I said above, allocating some data on the stack with C_alloc and passing that should be ok. cheers, felix _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users