4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>ForeignFunctionInterface</title>
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>
26 <h1>ForeignFunctionInterface</h1>
30 <div class="sectionbody">
31 <div class="paragraph"><p>MLton’s foreign function interface (FFI) extends Standard ML and makes
32 it easy to take the address of C global objects, access C global
33 variables, call from SML to C, and call from C to SML. MLton also
34 provides <a href="MLNLFFI">ML-NLFFI</a>, which is a higher-level FFI for calling
35 C functions and manipulating C data from SML.</p></div>
39 <h2 id="_overview">Overview</h2>
40 <div class="sectionbody">
41 <div class="ulist"><ul>
44 <a href="ForeignFunctionInterfaceTypes">Foreign Function Interface Types</a>
49 <a href="ForeignFunctionInterfaceSyntax">Foreign Function Interface Syntax</a>
56 <h2 id="_importing_code_into_sml">Importing Code into SML</h2>
57 <div class="sectionbody">
58 <div class="ulist"><ul>
61 <a href="CallingFromSMLToC">Calling From SML To C</a>
66 <a href="CallingFromSMLToCFunctionPointer">Calling From SML To C Function Pointer</a>
73 <h2 id="_exporting_code_from_sml">Exporting Code from SML</h2>
74 <div class="sectionbody">
75 <div class="ulist"><ul>
78 <a href="CallingFromCToSML">Calling From C To SML</a>
85 <h2 id="_building_system_libraries">Building System Libraries</h2>
86 <div class="sectionbody">
87 <div class="ulist"><ul>
90 <a href="LibrarySupport">Library Support</a>
97 <div id="footnotes"><hr></div>
99 <div id="footer-text">
101 <div id="footer-badges">