[plt-scheme] FFI + errno

From: hendrik at topoi.pooq.com (hendrik at topoi.pooq.com)
Date: Mon Dec 21 09:02:42 EST 2009

On Mon, Dec 21, 2009 at 01:30:14AM +0100, Thomas Chust wrote:
> Of course it would be functionally equivalent, but I think this variant
> looks cleaner and is more in the Scheme spirit since it treats the
> additional error code output of the function as an output instead of
> replicating the strange behaviour of C by storing a function output in a
> thread local parameter for no added value.

Having an errno variable instead of an extra parameter indicating where 
to return the error code was a conceptual mistake in the C library way 
back in the 70's when it was conceived; multithreading just made it 
obvious how bad the decision was.  Let's not propagate the conceptual 
error into Scheme.  Since we have to deal with C, however, let's at 
least handle the problem in the tools we build to call C and leave the 
resultin Scheme use of C code clean.

-- hendrik

Posted on the users mailing list.