4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
19 <body class="article">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
30 <div class="sectionbody">
31 <div class="paragraph"><p><a href="References#Blume01"> ML-NLFFI</a> is the no-longer-foreign-function interface
32 library for SML.</p></div>
33 <div class="paragraph"><p>As of 20050212, MLton has an initial port of ML-NLFFI from SML/NJ to
34 MLton. All of the ML-NLFFI functionality is present.</p></div>
35 <div class="paragraph"><p>Additionally, MLton has an initial port of the
36 <a href="MLNLFFIGen">mlnlffigen</a> tool from SML/NJ to MLton. Due to low-level
37 details, the code generated by SML/NJ’s <span class="monospaced">ml-nlffigen</span> is not
38 compatible with MLton, and vice-versa. However, the generated code
39 has the same interface, so portable client code can be written.
40 MLton’s <span class="monospaced">mlnlffigen</span> does not currently support C functions with
41 <span class="monospaced">struct</span> or <span class="monospaced">union</span> arguments.</p></div>
45 <h2 id="_usage">Usage</h2>
46 <div class="sectionbody">
47 <div class="ulist"><ul>
50 You can import the ML-NLFFI Library into an MLB file with
52 <table class="tableblock frame-all grid-all"
56 <col style="width:50%;">
57 <col style="width:50%;">
60 <th class="tableblock halign-left valign-top" >MLB file</th>
61 <th class="tableblock halign-left valign-top" >Description</th>
66 <td class="tableblock halign-left valign-top" ><p class="tableblock"><span class="monospaced">$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb</span></p></td>
67 <td class="tableblock halign-left valign-top" ><p class="tableblock"></p></td>
74 If you are porting a project from SML/NJ’s <a href="CompilationManager">CompilationManager</a> to
75 MLton’s <a href="MLBasis"> ML Basis system</a> using <span class="monospaced">cm2mlb</span>, note that the
76 following maps are included by default:
78 <div class="listingblock">
79 <div class="content monospaced">
80 <pre># MLNLFFI Library
81 $c $(SML_LIB)/mlnlffi-lib
82 $c/c.cm $(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb</pre>
84 <div class="paragraph"><p>This will automatically convert a <span class="monospaced">$/c.cm</span> import in an input <span class="monospaced">.cm</span>
85 file into a <span class="monospaced">$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb</span> import in the
86 output <span class="monospaced">.mlb</span> file.</p></div>
92 <h2 id="_also_see">Also see</h2>
93 <div class="sectionbody">
94 <div class="ulist"><ul>
97 <a href="References#Blume01">Blume01</a>
102 <a href="MLNLFFIImplementation">MLNLFFIImplementation</a>
107 <a href="MLNLFFIGen">MLNLFFIGen</a>
114 <div id="footnotes"><hr></div>
116 <div id="footer-text">
118 <div id="footer-badges">