From: marc daya <marc.daya+<ecl@gm...> - 2007-09-18 07:53:33
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
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?
Adding :short and :unsigned-short to the 'case' in (wt-coerce-loc), so that
they're handled in the same way as :byte and :unsigned-byte respectively,
seems to work ...
From: Juan Jose Garcia-Ripoll <jjgarcia@us...> - 2007-09-29 12:46:20
I need to understand better what your problem is.
2007/9/18, marc daya <marc.daya+ecl@...>:
> 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
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
> 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)