[Ecls-list] coercing :short in static-ffi

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Sat Sep 29 12:46:17 UTC 2007

Hi Marc,

I need to understand better what your problem is.

2007/9/18, marc daya <marc.daya+ecl at gmail.com>:
> I'm working with the native (C) library that has functions that expect
> short (int16_t) arguments,  but :short is not coerced during static-FFI
> compilation.

First of all, short = int16_t is a platform specific thing. This
equivalence is not true in general. But what I do not understand is
when you say ":short is not coerced". Can you post an specific
example? Does the compiler fail to work with a function that takes
:short arguments?

> There's a comment in the cmpffi.lsp saying that shorts are never selected
> to unbox data;  what is the reason for shorts being handled differently to
> bytes and ints?

Simply that ints >= short. The latter are contained in the former.
Thus, whenever ECL needs to convert a fixnum into a C integer, it uses
cl_fixnum or cl_index. But that should not be a problem, since C
automatically coerces any integer to a smaller type -- it does not
check for overflows, though.



Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)

More information about the ecl-devel mailing list