[gambit-list] Re: How to define c-lambda for this routine.

Bradley Lucier lucier at math.purdue.edu
Fri May 12 18:29:49 EDT 2006


On May 12, 2006, at 4:52 PM, Marc Feeley wrote:

> If you know the GC will never be called in the C function or you  
> don't care about safety, you could use the following approach.   
> There is a macro ___BODY(obj) defined in include/gambit.h which  
> returns a pointer to the body of any memory allocated object.  In  
> the case of vectors, it is a pointer to the first element.  So you  
> could write:
>
> (define rdft
>   (c-lambda (long long scheme-object scheme-object scheme-object)
>             void
>    "rdft(___arg1,
>          ___arg2,
>          (double*)___BODY(___arg3),
>          (long*)___BODY(___arg4),
>          (double*)___BODY(___arg5));"))

If the C code doesn't call back into Scheme then the gc can't be  
triggered, right?

Brad


More information about the Gambit-list mailing list