diff --git a/doc/ext_ffi_api.html b/doc/ext_ffi_api.html index b1b42878..2d69cb49 100644 --- a/doc/ext_ffi_api.html +++ b/doc/ext_ffi_api.html @@ -336,6 +336,28 @@ objects.
+Returns the error number set by the last C function call which +indicated an error condition. +
++This function offers a portable and OS-independent way to get the error +number. Note that only some C functions set the error +number. And it's only significant if the function actually indicated an +error condition (e.g. with a return value of -1 or +NULL). Otherwise, it may or may not contain any previously set +value. +
++You're advised to call this function only when needed and as close as +possible after the return of the related C function. The +errno value is preserved across hooks, memory allocations, +invocations of the JIT compiler and other internal VM activity. The same +applies to the value returned by GetLastError() on Windows, but +you need to declare and call it yourself. +
+
Creates an interned Lua string from the data pointed to by
diff --git a/src/lib_ffi.c b/src/lib_ffi.c
index 27996f0e..321de499 100644
--- a/src/lib_ffi.c
+++ b/src/lib_ffi.c
@@ -6,6 +6,8 @@
#define lib_ffi_c
#define LUA_LIB
+#include