summaryrefslogtreecommitdiff
path: root/doc/ext_ffi_api.html
diff options
context:
space:
mode:
authorMike Pall <mike>2011-05-08 22:34:40 +0200
committerMike Pall <mike>2011-05-08 22:34:40 +0200
commit868ecad32ba7fb3eb763642e22ebb06938fdb359 (patch)
tree3d5651f9d73145fb3a2a8a8c6ab125feae359ba1 /doc/ext_ffi_api.html
parent77ba7726e2f8b6ffe86be6c89b5beda5cab86d2d (diff)
downloadluajit2-868ecad32ba7fb3eb763642e22ebb06938fdb359.tar.gz
FFI: Add ffi.errno().
Diffstat (limited to 'doc/ext_ffi_api.html')
-rw-r--r--doc/ext_ffi_api.html22
1 files changed, 22 insertions, 0 deletions
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.
<h2 id="util">Utility Functions</h2>
+<h3 id="ffi_errno"><tt>err = ffi.errno()</tt></h3>
+<p>
+Returns the error number set by the last C&nbsp;function call which
+indicated an error condition.
+</p>
+<p>
+This function offers a portable and OS-independent way to get the error
+number. Note that only <em>some</em> C&nbsp;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 <tt>-1</tt> or
+<tt>NULL</tt>). Otherwise, it may or may not contain any previously set
+value.
+</p>
+<p>
+You're advised to call this function only when needed and as close as
+possible after the return of the related C&nbsp;function. The
+<tt>errno</tt> 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 <tt>GetLastError()</tt> on Windows, but
+you need to declare and call it yourself.
+</p>
+
<h3 id="ffi_string"><tt>str = ffi.string(ptr [,len])</tt></h3>
<p>
Creates an interned Lua string from the data pointed to by