<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>MLNLFFI</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css"/>
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20130715</a>
</div>
</div>
<div id="header">
<h1>MLNLFFI</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p><a href="References#Blume01"> ML-NLFFI</a> is the no-longer-foreign-function interface
library for SML.</p></div>
<div class="paragraph"><p>As of 20050212, MLton has an initial port of ML-NLFFI from SML/NJ to
MLton.  All of the ML-NLFFI functionality is present.</p></div>
<div class="paragraph"><p>Additionally, MLton has an initial port of the
<a href="MLNLFFIGen">mlnlffigen</a> tool from SML/NJ to MLton.  Due to low-level
details, the code generated by SML/NJ&#8217;s <span class="monospaced">ml-nlffigen</span> is not
compatible with MLton, and vice-versa.  However, the generated code
has the same interface, so portable client code can be written.
MLton&#8217;s <span class="monospaced">mlnlffigen</span> does not currently support C functions with
<span class="monospaced">struct</span> or <span class="monospaced">union</span> arguments.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_usage">Usage</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
You can import the ML-NLFFI Library into an MLB file with
</p>
<table class="tableblock frame-all grid-all"
style="
width:100%;
">
<col style="width:50%;">
<col style="width:50%;">
<thead>
<tr>
<th class="tableblock halign-left valign-top" >MLB file</th>
<th class="tableblock halign-left valign-top" >Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top" ><p class="tableblock"><span class="monospaced">$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock"></p></td>
</tr>
</tbody>
</table>
</li>
<li>
<p>
If you are porting a project from SML/NJ&#8217;s <a href="CompilationManager">CompilationManager</a> to
MLton&#8217;s <a href="MLBasis"> ML Basis system</a> using <span class="monospaced">cm2mlb</span>, note that the
following maps are included by default:
</p>
<div class="listingblock">
<div class="content monospaced">
<pre># MLNLFFI Library
$c                                      $(SML_LIB)/mlnlffi-lib
$c/c.cm                                 $(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb</pre>
</div></div>
<div class="paragraph"><p>This will automatically convert a <span class="monospaced">$/c.cm</span> import in an input <span class="monospaced">.cm</span>
file into a <span class="monospaced">$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb</span> import in the
output <span class="monospaced">.mlb</span> file.</p></div>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_also_see">Also see</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
<a href="References#Blume01">Blume01</a>
</p>
</li>
<li>
<p>
<a href="MLNLFFIImplementation">MLNLFFIImplementation</a>
</p>
</li>
<li>
<p>
<a href="MLNLFFIGen">MLNLFFIGen</a>
</p>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
