lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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...

Justin