lua-users home
lua-l archive

Re: LuaJIT FFI callbacks (was Re: Calling lua functions from C when using luajit ffi.)

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


Duncan Cross wrote:
> One thing - I'm not certain this is related to the addition of
> callbacks, but I was just experimenting with Win32 calls and found
> that GetLastError() seems to return the wrong value (127,
> ERROR_PROC_NOT_FOUND) the first time it's called. This is a minimal
> test case:
> 
> local ffi = require("ffi")
> 
> ffi.cdef [[
> uint32_t GetLastError();
> void SetLastError(uint32_t code);
> ]]
> 
> ffi.C.SetLastError(0)
> print(ffi.C.GetLastError()) -- 127
> ffi.C.SetLastError(0)
> print(ffi.C.GetLastError()) -- 0
Sorry, I forgot to save the error value around ffi.load() and
symbol resolving.
Thank you for the report! Fixed in git HEAD.
--Mike

AltStyle によって変換されたページ (->オリジナル) /