lua-users home
lua-l archive

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


On Sun, 2011-05-08 at 22:58 +0200, Mike Pall wrote:
> I've fixed this in git HEAD. LuaJIT now preserves errno across
> hooks, memory allocations, invocations of the JIT compiler and
> other internal VM activity. Ditto for GetLastError() on Windows.
> 
> And I've added ffi.errno() which provides an OS-independent and
> portable way to get errno. See:
>   http://luajit.org/ext_ffi_api.html#ffi_errno

This is working really well, it is so nice using the ffi API! I have
started doing a Linux syscall ffi interface here
https://github.com/justincormack/ljsyscall and it is really quick and
easy, with nice gc of file descriptors.

> I think that would go a bit too far. However, I'm planning to add
> user-definable inline machine code (*). This would allow you to
> directly invoke system calls.
> 
> (*) Maybe like this:
> 
> ffi.cdef[[
> void __prefetchnta(void *p) __mcode("0F180m");
> float __rsqrtss(float x) __mcode("F30F52rM");
> ]]
> 
> I'll probably need this e.g. for SIMD ops on native vector types.
> But it's only an idea right now. No ETA for this feature, yet.

Will probably find a use for it!

Thanks very much

Justin