summaryrefslogtreecommitdiff
path: root/doc/ext_ffi_tutorial.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ext_ffi_tutorial.html')
-rw-r--r--doc/ext_ffi_tutorial.html91
1 files changed, 91 insertions, 0 deletions
diff --git a/doc/ext_ffi_tutorial.html b/doc/ext_ffi_tutorial.html
new file mode 100644
index 00000000..11e83339
--- /dev/null
+++ b/doc/ext_ffi_tutorial.html
@@ -0,0 +1,91 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4<title>FFI Tutorial</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<meta name="Author" content="Mike Pall">
7<meta name="Copyright" content="Copyright (C) 2005-2011, Mike Pall">
8<meta name="Language" content="en">
9<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11</head>
12<body>
13<div id="site">
14<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
15</div>
16<div id="head">
17<h1>FFI Tutorial</h1>
18</div>
19<div id="nav">
20<ul><li>
21<a href="luajit.html">LuaJIT</a>
22<ul><li>
23<a href="install.html">Installation</a>
24</li><li>
25<a href="running.html">Running</a>
26</li></ul>
27</li><li>
28<a href="extensions.html">Extensions</a>
29<ul><li>
30<a href="ext_ffi.html">FFI Library</a>
31<ul><li>
32<a class="current" href="ext_ffi_tutorial.html">FFI Tutorial</a>
33</li><li>
34<a href="ext_ffi_api.html">ffi.* API</a>
35</li><li>
36<a href="ext_ffi_int64.html">64 bit Integers</a>
37</li><li>
38<a href="ext_ffi_semantics.html">FFI Semantics</a>
39</li></ul>
40</li><li>
41<a href="ext_jit.html">jit.* Library</a>
42</li><li>
43<a href="ext_c_api.html">Lua/C API</a>
44</li></ul>
45</li><li>
46<a href="status.html">Status</a>
47<ul><li>
48<a href="changes.html">Changes</a>
49</li></ul>
50</li><li>
51<a href="faq.html">FAQ</a>
52</li><li>
53<a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
54</li><li>
55<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
56</li></ul>
57</div>
58<div id="main">
59<p>
60TODO
61</p>
62
63<h2 id="load">Loading the FFI Library</h2>
64<p>
65The FFI library is built into LuaJIT by default, but it's not loaded
66and initialized by default. The suggested way to use the FFI library
67is to add the following to the start of every Lua file that needs one
68of its functions:
69</p>
70<pre class="code">
71local ffi = require("ffi")
72</pre>
73<p>
74Please note this doesn't define an <tt>ffi</tt> variable in the table
75of globals &mdash; you really need to use the local variable. The
76<tt>require</tt> function ensures the library is only loaded once.
77</p>
78
79<h2>TODO</h2>
80<br class="flush">
81</div>
82<div id="foot">
83<hr class="hide">
84Copyright &copy; 2005-2011 Mike Pall
85<span class="noprint">
86&middot;
87<a href="contact.html">Contact</a>
88</span>
89</div>
90</body>
91</html>