[Ecls-list] FFI type mismatch for integer

Goffioul Michael goffioul at imec.be
Fri Jun 3 06:56:59 UTC 2005


> >I got a problem while playing with FFI and integer types 
> (I'm actually trying
> >to build a FFI interface for Win32 GUI API). The problem is 
> that conversion
> >between C and LISP is not invertable:
> >	C -> LISP : make_integer, which can produce bignums
> >	LISP -> C : object_to_fixnum, which can not handle 
> bignums (the ones produced
> >			by make_integer)
> >I think there should be a "object_to_integer"  function.
> >  
> >
> Yes, I am not happy with the current set of functions. fixnnint() and 
> fixint() are the functions you were looking for, and they should be 
> renamed to something like ecl_object2long and ecl_object2ulong, to be 
> consistent. and also because they internally use "longs".
> 
> >Another point is that FFI doesn't seem to conserve signness 
> of integers as "make_integer" is used whether you defined the 
> object type as :int or :unsigned-int.
> >
> Maybe also complementary functions ecl_long2object and 
> ecl_ulong2object?

Attached is a rapid patch that fixes the problem.

Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffi-uint.diff.gz
Type: application/x-gzip
Size: 1095 bytes
Desc: ffi-uint.diff.gz
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20050603/84ffb360/attachment.bin>


More information about the ecl-devel mailing list