aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/running.html44
1 files changed, 36 insertions, 8 deletions
diff --git a/doc/running.html b/doc/running.html
index cf1bdc45..109df5df 100644
--- a/doc/running.html
+++ b/doc/running.html
@@ -118,28 +118,56 @@ are accepted:
118<li><tt>-l</tt> &mdash; Only list bytecode.</li> 118<li><tt>-l</tt> &mdash; Only list bytecode.</li>
119<li><tt>-s</tt> &mdash; Strip debug info (this is the default).</li> 119<li><tt>-s</tt> &mdash; Strip debug info (this is the default).</li>
120<li><tt>-g</tt> &mdash; Keep debug info.</li> 120<li><tt>-g</tt> &mdash; Keep debug info.</li>
121<li><tt>-n name</tt> &mdash; Set module name (default: auto-detect from input name)</li>
122<li><tt>-t type</tt> &mdash; Set output file type (default: auto-detect from output name).</li>
123<li><tt>-a arch</tt> &mdash; Override architecture for object files (default: native).</li>
124<li><tt>-o os</tt> &mdash; Override OS for object files (default: native).</li>
121<li><tt>-e chunk</tt> &mdash; Use chunk string as input.</li> 125<li><tt>-e chunk</tt> &mdash; Use chunk string as input.</li>
122<li><tt>-</tt> (a single minus sign) &mdash; Use stdin as input and/or stdout as output.</li> 126<li><tt>-</tt> (a single minus sign) &mdash; Use stdin as input and/or stdout as output.</li>
123</ul> 127</ul>
124<p> 128<p>
129The output file type is auto-detected from the extension of the output
130file name:
131</p>
132<ul>
133<li><tt>c</tt> &mdash; C source file, exported bytecode data.</li>
134<li><tt>h</tt> &mdash; C header file, static bytecode data.</li>
135<li><tt>obj</tt> or <tt>o</tt> &mdash; Object file, exported bytecode data
136(OS- and architecture-specific).</li>
137<li><tt>raw</tt> or any other extension &mdash; Raw bytecode file (portable).
138</ul>
139<p>
140Notes:
141</p>
142<ul>
143<li>See also <a href="extensions.html#string_dump">string.dump()</a>
144for information on bytecode portability and compatibility.</li>
145<li>A file in raw bytecode format is auto-detected and can be loaded like
146any Lua source file. E.g. directly from the command line or with
147<tt>loadfile()</tt>, <tt>dofile()</tt> etc.</li>
148<li>To statically embed the bytecode of a module in your application,
149generate an object file and just link it with your application.</li>
150<li>On most ELF-based systems (e.g. Linux) you need to explicitly export the
151global symbols when linking your application, e.g. with: <tt>-Wl,-E</tt></li>
152<li><tt>require()</tt> tries to load embedded bytecode data from exported
153symbols (in <tt>*.exe</tt> or <tt>lua51.dll</tt> on Windows) and from
154shared libraries in <tt>package.cpath</tt>.</li>
155</ul>
156<p>
125Typical usage examples: 157Typical usage examples:
126</p> 158</p>
127<pre class="code"> 159<pre class="code">
128luajit -b test.lua test.out # Save to test.out 160luajit -b test.lua test.out # Save bytecode to test.out
129luajit -bg test.lua test.out # Keep debug info 161luajit -bg test.lua test.out # Keep debug info
130luajit -be "print('hello world')" test.out # Save cmdline script 162luajit -be "print('hello world')" test.out # Save cmdline script
131 163
132luajit -bl test.lua # List to stdout 164luajit -bl test.lua # List to stdout
133luajit -bl test.lua test.txt # List to test.txt 165luajit -bl test.lua test.txt # List to test.txt
134luajit -ble "print('hello world')" # List cmdline script 166luajit -ble "print('hello world')" # List cmdline script
167
168luajit -b test.lua test.obj # Generate object file
169# Link test.obj with your application and load it with require("test")
135</pre> 170</pre>
136<p>
137Note: A file in bytecode format is auto-detected and can be loaded like
138any Lua source file. E.g. directly from the command line or with
139<tt>loadfile()</tt>, <tt>dofile()</tt> etc. See also
140<a href="extensions.html#string_dump">string.dump()</a> for information
141on bytecode portability and compatibility.
142</p>
143 171
144<h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3> 172<h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3>
145<p> 173<p>