Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / MLNLFFI.adoc
1 MLNLFFI
2 =======
3
4 <!Cite(Blume01, ML-NLFFI)> is the no-longer-foreign-function interface
5 library for SML.
6
7 As of 20050212, MLton has an initial port of ML-NLFFI from SML/NJ to
8 MLton. All of the ML-NLFFI functionality is present.
9
10 Additionally, MLton has an initial port of the
11 <:MLNLFFIGen:mlnlffigen> tool from SML/NJ to MLton. Due to low-level
12 details, the code generated by SML/NJ's `ml-nlffigen` is not
13 compatible with MLton, and vice-versa. However, the generated code
14 has the same interface, so portable client code can be written.
15 MLton's `mlnlffigen` does not currently support C functions with
16 `struct` or `union` arguments.
17
18 == Usage ==
19
20 * You can import the ML-NLFFI Library into an MLB file with
21 +
22 [options="header"]
23 |=====
24 |MLB file|Description
25 |`$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb`|
26 |=====
27
28 * If you are porting a project from SML/NJ's <:CompilationManager:> to
29 MLton's <:MLBasis: ML Basis system> using `cm2mlb`, note that the
30 following maps are included by default:
31 +
32 ----
33 # MLNLFFI Library
34 $c $(SML_LIB)/mlnlffi-lib
35 $c/c.cm $(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb
36 ----
37 +
38 This will automatically convert a `$/c.cm` import in an input `.cm`
39 file into a `$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb` import in the
40 output `.mlb` file.
41
42 == Also see ==
43
44 * <!Cite(Blume01)>
45 * <:MLNLFFIImplementation:>
46 * <:MLNLFFIGen:>