[gambit-list] Returning a byte array from C
feeley at iro.umontreal.ca
Thu Sep 26 10:29:43 EDT 2013
On 2013-09-26, at 12:21 AM, Vijay Mathew <vijay.the.lisper at gmail.com> wrote:
> Thanks again for all the great feedback!
> I think the call to ____FIX() is not required if Scheme code access the C function through a declaration like this:
> (define read-bytes (c-lambda (int unsigned-int scheme-object) int "read_bytes"))
> Is that correct?
That is correct. However, using ___FIX() is faster for converting a C integer to a Scheme fixnum. And ___INT() is faster for converting a Scheme fixnum to a C integer. So better performance is obtained with:
(c-lambda (scheme-object scheme-object scheme-object)
"___result = ___FIX(read (___INT(___arg1),___BODY(___arg3),___INT(___arg2));"))
More information about the Gambit-list