[plt-scheme] FFI + errno

From: Thomas Chust (chust at web.de)
Date: Sun Dec 20 02:56:49 EST 2009

[resending the message since it never made it to the mailing list]

2009/12/15 Matthew Flatt <mflatt at cs.utah.edu>:
> [...]
> With the latest in SVN (v4.2.3.5), the `_fun' form of `scheme/foreign'
> supports an optional `#:save-errno' specification that makes the FFI
> squirrel away the value of `errno' immediately after a foreign call.
> The saved value is available through a new `saved-errno' function.
> [...]


wouldn't it be nicer to have a special kind of output specification
for errno values in a _fun form? Since errno is effectively a
container for an additional return value from a function, not some
kind of permanent state variable, this would seem more natural to me.
It would also make error handling for functions with special error
return values and functions which just set errno more similar, and it
would probably cause less runtime overhead.


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.