[cffi-devel] uffi compatible library

Gustavo gugamilare at gmail.com
Tue Aug 10 16:45:38 UTC 2010


Hello, again,

I found one inconsistency in uffi's documentation. Uffi's doc says that
dereferencing types :char and :unsigned-char return characters where
actually it returns integers (at least here). Cffi's uffi-compat follows the
doc and that also breaks elephant. Sending a new patch that "fix" that and
also has a change necessary to def-function accept directions.

Please let me know whether my patches will get into cffi or if there is
something I should change in them.

Now off to find more errors...

Gustavo.

Em 6 de agosto de 2010 11:19, Gustavo <gugamilare at gmail.com> escreveu:

> Hello,
>
> Sorry, my definition of "tomorrow" and "day duration" is a little distorted
> :3
>
> My previous patch was kind of messy, so I decided to restart everything
> from the concept. Instead of the argument directions to be handled by the
> macro expansion and (complicated) auxiliary functions, it is now handled
> (mainly) by translate-objects and expand-to-foreign-dyn.
>
> Also, tests for varargs functions are a bit hackish because I don't know
> how to create a C function with variadic argument. I don't know if it will
> work on all systems. Anyway, the tests are there, just test them and see if
> they work ;)
>
> Gustavo.
>
> Em 14 de julho de 2010 23:01, Gustavo <gugamilare at gmail.com> escreveu:
>
>> Hello, again,
>>
>> I've added support for :in, :out, :in-out and :copy direction arguments
>> except for defcfun with &rest args. The patch is attached, it includes some
>> tests. Anyone may feel free to add more tests if it is convenient.
>>
>>
>> For defcfun with &rest arguments, I still need to test so I didn't include
>> it in my patch. I'll do that tomorrow.
>>
>> Changing subject, I noted that, *without* my changes, there are 4
>> unexpected failures with cffi in my system (and 2 expected).
>>
>> The tests FUNCALL.VARARGS.DOUBLE, DEFCFUN.VARARGS.FLOAT,
>> DEFCFUN.VARARGS.DOUBLE fail because of localization issues. Here in Brazil,
>> we write "3,14" instead of "3.14" and sprintf takes that into account. Not a
>> big problem, though, just notifying.
>>
>> The test DEFCFUN.BFF.2 fails, I suspect it is because of the precision of
>> doubles. The function returns the first, the second is expected.
>>
>> 7758614624042983568
>> 7758614658402721936
>>
>> The expected failures are STRING.ENCODING.UTF-16.BASIC and
>> STRING.ENCODINGS.ALL.BASIC.
>>
>> SBCL 1.0.40, 32-bit Ubuntu.
>>
>> Now, except for those tests that were already failing, my changes didn't
>> fail even a single one of them :)
>>
>> Gustavo.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20100810/94618bb1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-uffi-def-function-and-characters.patch
Type: text/x-diff
Size: 10570 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20100810/94618bb1/attachment.patch>


More information about the cffi-devel mailing list