GNU bug report logs -
#18592
FFI should have portable access to ‘errno’
Previous Next
Full log
Message #31 received at 18592 <at> debbugs.gnu.org (full text, mbox):
Mark H Weaver <mhw <at> netris.org> skribis:
> ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> Chaos Eternal <chaoseternal <at> shlug.org> skribis:
>>
>>> Proposals to solve this bug:
>>>
>>> Proposal 1.
>>>
>>> Adding a keyword argument to pointer->procedure, if set to true, the
>>> generated wrapper will check 'errno' immediately after ffi_call and
>>> return the errno as second value.
>>>
>>> the proposed pointer->procedure maybe like this:
>>> pointer->procedure return_type func_ptr arg_types #:return-errno
>>>
>>> Proposal 2.
>>>
>>> let pointer->procedure check return_type, if it is a list:
>>> (func_return_type, 'errno)
>>> then return multiple values, as errno be second value.
>>
>> That’s my favorite because it’s both pragmatic and extensible (we can
>> also add support for h_errno, etc.)
>
> We can't do this, because although it's not documented in our manual, a
> list passed as a foreign type already has a meaning: it means a struct.
> See 'parse_ffi_type' in foreign.c. I mentioned this fact on guile-user:
>
> https://lists.gnu.org/archive/html/guile-user/2012-05/msg00037.html
Indeed, I had forgotten that.
> Of the proposals given here, I would support #1, but maybe there's a
> better option.
I agree #1 is now the best option so far.
Ludo’.
This bug report was last modified 8 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.