[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Luajit and errno
- From: Justin Cormack <justin@...>
- Date: Fri, 06 May 2011 19:14:42 +0100
On Tue, 2011-04-26 at 00:13 +0200, Mike Pall wrote:
> I have a couple of ideas on how to provide a portable ffi.C.errno
> abstraction which doesn't lose its state. But no convincing
> solution. And then there's GetLastError() on Windows, too ...
Thinking about this some more, I wonder if you might be persuaded to add
an ffi.syscall() function; obviously it would be architecture dependent,
and there might have to be a few OS variations if people dont use the
standard ABI. This could know how registers are clobbered and so on.
Then it would be easy to wrap the standard system call functions, with
no errno issues in pure Lua for each OS with just a small amount of
code. I dont think the errno issue is so important for the non syscall C
functions, as most of these have Lua equivalents anyway...