Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / MLNLFFI
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>MLNLFFI</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
9
10
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
13 /*<![CDATA[*/
14 asciidoc.install();
15 /*]]>*/
16 </script>
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
18 </head>
19 <body class="article">
20 <div id="banner">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
23 </div>
24 </div>
25 <div id="header">
26 <h1>MLNLFFI</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
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&#8217;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&#8217;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>
42 </div>
43 </div>
44 <div class="sect1">
45 <h2 id="_usage">Usage</h2>
46 <div class="sectionbody">
47 <div class="ulist"><ul>
48 <li>
49 <p>
50 You can import the ML-NLFFI Library into an MLB file with
51 </p>
52 <table class="tableblock frame-all grid-all"
53 style="
54 width:100%;
55 ">
56 <col style="width:50%;">
57 <col style="width:50%;">
58 <thead>
59 <tr>
60 <th class="tableblock halign-left valign-top" >MLB file</th>
61 <th class="tableblock halign-left valign-top" >Description</th>
62 </tr>
63 </thead>
64 <tbody>
65 <tr>
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>
68 </tr>
69 </tbody>
70 </table>
71 </li>
72 <li>
73 <p>
74 If you are porting a project from SML/NJ&#8217;s <a href="CompilationManager">CompilationManager</a> to
75 MLton&#8217;s <a href="MLBasis"> ML Basis system</a> using <span class="monospaced">cm2mlb</span>, note that the
76 following maps are included by default:
77 </p>
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>
83 </div></div>
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>
87 </li>
88 </ul></div>
89 </div>
90 </div>
91 <div class="sect1">
92 <h2 id="_also_see">Also see</h2>
93 <div class="sectionbody">
94 <div class="ulist"><ul>
95 <li>
96 <p>
97 <a href="References#Blume01">Blume01</a>
98 </p>
99 </li>
100 <li>
101 <p>
102 <a href="MLNLFFIImplementation">MLNLFFIImplementation</a>
103 </p>
104 </li>
105 <li>
106 <p>
107 <a href="MLNLFFIGen">MLNLFFIGen</a>
108 </p>
109 </li>
110 </ul></div>
111 </div>
112 </div>
113 </div>
114 <div id="footnotes"><hr></div>
115 <div id="footer">
116 <div id="footer-text">
117 </div>
118 <div id="footer-badges">
119 </div>
120 </div>
121 </body>
122 </html>