You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

187 lines
4.8 KiB

<h1 id="portability">Portability</h1>
<h2>Platforms and compilers</h2>
<p>The table below summarizes the platforms and compilers which Duktape is known
to work on, with portability notes where appropriate. This is <b>not an exhaustive
list</b> of supported/unsupported platforms, rather a list of what is known to work
(and not to work). Platform and compiler specific issues are discussed in more
detail below the table.</p>
<table>
<thead>
<tr>
<th>Operating system</th>
<th>Compiler</th>
<th>Processor</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>Linux</td>
<td>GCC</td>
<td>x86</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>GCC</td>
<td>x64</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>GCC</td>
<td>ARM</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>GCC</td>
<td>MIPS</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>Clang</td>
<td>x86</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>Clang</td>
<td>x64</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>Clang</td>
<td>ARM</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>Clang</td>
<td>MIPS</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Linux</td>
<td>TCC</td>
<td>x64</td>
<td>Zero sign issues (see below).</td>
</tr>
<tr>
<td>FreeBSD</td>
<td>Clang</td>
<td>x86</td>
<td>Aliasing issues with clang 3.3 on 64-bit FreeBSD, <code>-m32</code>, and packed <code>duk_tval</code> (see below).</td>
</tr>
<tr>
<td>FreeBSD</td>
<td>Clang</td>
<td>x64</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Windows</td>
<td>MinGW</td>
<td>x86</td>
<td><code>-std=c99</code> recommended, only ISO 8601 date format supported (no platform specific format).</td>
</tr>
<tr>
<td>Windows</td>
<td>MinGW-w64</td>
<td>x64</td>
<td><code>-m64</code>, <code>-std=c99</code> recommended, only ISO 8601 date format supported (no platform specific format).</td>
</tr>
<tr>
<td>Windows</td>
<td>MSVC<br />(Visual Studio Express 2010)</td>
<td>x86</td>
<td>Only ISO 8601 date format supported (no platform specific format).</td>
</tr>
<tr>
<td>Windows</td>
<td>MSVC<br />(Visual Studio Express 2013 for Windows Desktop)</td>
<td>x64</td>
<td>Only ISO 8601 date format supported (no platform specific format).</td>
</tr>
<tr>
<td>Android</td>
<td>GCC<br />(Android NDK)</td>
<td>ARM</td>
<td>No known issues.</td>
</tr>
<tr>
<td>Darwin</td>
<td>GCC</td>
<td>x86</td>
<td>No known issues.</td>
</tr>
<tr>
<td>AmigaOS</td>
<td>VBCC</td>
<td>M68K</td>
<td>Requires some preprocessor defines, datetime resolution limited to full seconds.</td>
</tr>
<tr>
<td>TOS<br />(Atari ST)</td>
<td>VBCC</td>
<td>M68K</td>
<td>Requires some preprocessor defines, datetime resolution limited to full seconds.</td>
</tr>
</tbody>
</table>
<h3>Clang</h3>
<p>Clang 3.3 on FreeBSD has some aliasing issues (at least) when using
<code>-m32</code> and when Duktape ends up using a packed <code>duk_tval</code>
value representation type. The problem does not appear in all clang versions.
Duktape self tests cover this issue (define <code>DUK_OPT_SELF_TESTS</code>
when compiling). See internal test file <code>misc/clang_aliasing.c</code>.</p>
<h3>TCC</h3>
<p>TCC has zero sign handling issues; Duktape mostly works but zero sign is
not handled correctly. This results in Ecmascript non-compliance, for
instance <code>1/-0</code> evaluates to <code>Infinity</code>, not <code>-Infinity</code>
as it should.</p>
<h3>VBCC (AmigaOS / TOS)</h3>
<p>VBCC doesn't appear to provide OS or processor defines. To compile for
M68K AmigaOS or TOS you must:</p>
<ul>
<li>Define <code>__MC68K__</code> manually.</li>
<li>Define either <code>AMIGA</code> or <code>__TOS__</code> manually.</li>
</ul>
<p>Datetime resolution is limited to full seconds only when using VBCC on
AmigaOS or TOS.</p>
<h2>Using Duktape from a C++ program</h2>
<p>To use Duktape from a C++ program, simply compile Duktape in plain C and use
<code>duktape.h</code> normally in your C++ program; <code>duktape.h</code>
contains the necessary glue to make this work. Specifically, it contains
<code>extern "C" { ... }</code> to avoid name mangling issues.</p>
<p>Currently Duktape itself cannot be compiled in C++ mode. This is under
work but is not a trivial issue because many of the compiler defines and
headers are different (especially for pre C99/C++11).</p>
<h2>Limitations</h2>
<ul>
<li>The <code>int</code> type is assumed to be at least 32 bits. This is
incorrect even on some platforms which provide a 32-bit type.</li>
<li>Pointer less-than/greater-than comparisons are expected to work like
pointers were unsigned. This is incorrect on some platforms.</li>
<li>On platforms requiring aligned accesses, Duktape guarantees 4-byte
alignment. In particular, 64-bit integers and IEEE double values are
not guaranteed to be 8-byte aligned. This is not always correct.</li>
</ul>