FFI: Fix resolving of function name redirects on Windows/x86.
[luajit-2.0.git] / doc / faq.html
blobf4bc9edd0370223dc61868de1c1bc34df84e4682
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <title>Frequently Asked Questions (FAQ)</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-2012, 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 <style type="text/css">
12 dd { margin-left: 1.5em; }
13 </style>
14 </head>
15 <body>
16 <div id="site">
17 <a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
18 </div>
19 <div id="head">
20 <h1>Frequently Asked Questions (FAQ)</h1>
21 </div>
22 <div id="nav">
23 <ul><li>
24 <a href="luajit.html">LuaJIT</a>
25 <ul><li>
26 <a href="install.html">Installation</a>
27 </li><li>
28 <a href="running.html">Running</a>
29 </li></ul>
30 </li><li>
31 <a href="extensions.html">Extensions</a>
32 <ul><li>
33 <a href="ext_ffi.html">FFI Library</a>
34 <ul><li>
35 <a href="ext_ffi_tutorial.html">FFI Tutorial</a>
36 </li><li>
37 <a href="ext_ffi_api.html">ffi.* API</a>
38 </li><li>
39 <a href="ext_ffi_semantics.html">FFI Semantics</a>
40 </li></ul>
41 </li><li>
42 <a href="ext_jit.html">jit.* Library</a>
43 </li><li>
44 <a href="ext_c_api.html">Lua/C API</a>
45 </li></ul>
46 </li><li>
47 <a href="status.html">Status</a>
48 <ul><li>
49 <a href="changes.html">Changes</a>
50 </li></ul>
51 </li><li>
52 <a class="current" href="faq.html">FAQ</a>
53 </li><li>
54 <a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
55 </li><li>
56 <a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
57 </li></ul>
58 </div>
59 <div id="main">
60 <dl>
61 <dt>Q: Where can I learn more about Lua and LuaJIT?</dt>
62 <dd>
63 <ul style="padding: 0;">
64 <li>The <a href="http://lua.org"><span class="ext">&raquo;</span>&nbsp;main Lua.org site</a> has complete
65 <a href="http://www.lua.org/docs.html"><span class="ext">&raquo;</span>&nbsp;documentation</a> of the language
66 and links to books and papers about Lua.</li>
67 <li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a>
68 has information about diverse topics.</li>
69 <li>The primary source of information for the latest developments surrounding
70 Lua is the <a href="http://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
71 You can check out the <a href="http://lua-users.org/lists/lua-l/"><span class="ext">&raquo;</span>&nbsp;mailing
72 list archive</a> or
73 <a href="http://bazar2.conectiva.com.br/mailman/listinfo/lua"><span class="ext">&raquo;</span>&nbsp;subscribe</a>
74 to the list (you need to be subscribed before posting).<br>
75 This is also the place where announcements and discussions about LuaJIT
76 take place.</li>
77 </ul>
78 </dl>
80 <dl>
81 <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt>
82 <dd>
83 I'm planning to write more documentation about the internals of LuaJIT.
84 In the meantime, please use the following Google Scholar searches
85 to find relevant papers:<br>
86 Search for: <a href="http://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">&raquo;</span>&nbsp;Trace Compiler</a><br>
87 Search for: <a href="http://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">&raquo;</span>&nbsp;JIT Compiler</a><br>
88 Search for: <a href="http://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">&raquo;</span>&nbsp;Dynamic Language Optimizations</a><br>
89 Search for: <a href="http://scholar.google.com/scholar?q=SSA+Form"><span class="ext">&raquo;</span>&nbsp;SSA Form</a><br>
90 Search for: <a href="http://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">&raquo;</span>&nbsp;Linear Scan Register Allocation</a><br>
91 Here is a list of the <a href="http://article.gmane.org/gmane.comp.lang.lua.general/58908"><span class="ext">&raquo;</span>&nbsp;innovative features in LuaJIT</a>.<br>
92 And, you know, reading the source is of course the only way to enlightenment. :-)
93 </dd>
94 </dl>
96 <dl>
97 <dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br>
98 Q: My vararg functions fail after switching to LuaJIT!</dt>
99 <dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
100 support the implicit <tt>arg</tt> parameter for old-style vararg
101 functions from Lua 5.0.<br>Please convert your code to the
102 <a href="http://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">&raquo;</span>&nbsp;Lua 5.1
103 vararg syntax</a>.</dd>
104 </dl>
106 <dl>
107 <dt>Q: Why do I get this error: "bad FPU precision"?<br>
108 <dt>Q: I get weird behavior after initializing Direct3D.<br>
109 <dt>Q: Some FPU operations crash after I load a Delphi DLL.<br>
110 </dt>
111 <dd>
113 DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision
114 mode by default. This violates the Windows ABI and interferes with the
115 operation of many programs &mdash; LuaJIT is affected, too. Please make
116 sure you always use the <tt>D3DCREATE_FPU_PRESERVE</tt> flag when
117 initializing Direct3D.<br>
119 Direct3D version 10 or higher do not show this behavior anymore.
120 Consider testing your application with older versions, too.<br>
122 Similarly, the Borland/Delphi runtime modifies the FPU control word and
123 enables FP exceptions. Of course this violates the Windows ABI, too.
124 Please check the Delphi docs for the Set8087CW method.
126 </dl>
128 <dl>
129 <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt>
130 <dd>The interrupt signal handler sets a Lua debug hook. But this is
131 currently ignored by compiled code (this will eventually be fixed). If
132 your program is running in a tight loop and never falls back to the
133 interpreter, the debug hook never runs and can't throw the
134 "interrupted!" error.<br> In the meantime you have to press Ctrl-C
135 twice to get stop your program. That's similar to when it's stuck
136 running inside a C function under the Lua interpreter.</dd>
137 </dl>
139 <dl>
140 <dt>Q: Why doesn't my favorite power-patch for Lua apply against LuaJIT?</dt>
141 <dd>Because it's a completely redesigned VM and has very little code
142 in common with Lua anymore. Also, if the patch introduces changes to
143 the Lua semantics, these would need to be reflected everywhere in the
144 VM, from the interpreter up to all stages of the compiler.<br> Please
145 use only standard Lua language constructs. For many common needs you
146 can use source transformations or use wrapper or proxy functions.
147 The compiler will happily optimize away such indirections.</dd>
148 </dl>
150 <dl>
151 <dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt>
152 <dd>Because it's a compiler &mdash; it needs to generate native
153 machine code. This means the code generator must be ported to each
154 architecture. And the fast interpreter is written in assembler and
155 must be ported, too. This is quite an undertaking.<br>
156 The <a href="install.html">install documentation</a> shows the supported
157 architectures. Other architectures will follow based on sufficient user
158 demand and/or sponsoring.</dd>
159 </dl>
161 <dl>
162 <dt>Q: When will feature X be added? When will the next version be released?</dt>
163 <dd>When it's ready.<br>
164 C'mon, it's open source &mdash; I'm doing it on my own time and you're
165 getting it for free. You can either contribute a patch or sponsor
166 the development of certain features, if they are important to you.
167 </dd>
168 </dl>
169 <br class="flush">
170 </div>
171 <div id="foot">
172 <hr class="hide">
173 Copyright &copy; 2005-2012 Mike Pall
174 <span class="noprint">
175 &middot;
176 <a href="contact.html">Contact</a>
177 </span>
178 </div>
179 </body>
180 </html>