Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / MLNLFFI.adoc
CommitLineData
7f918cf1
CE
1MLNLFFI
2=======
3
4<!Cite(Blume01, ML-NLFFI)> is the no-longer-foreign-function interface
5library for SML.
6
7As of 20050212, MLton has an initial port of ML-NLFFI from SML/NJ to
8MLton. All of the ML-NLFFI functionality is present.
9
10Additionally, MLton has an initial port of the
11<:MLNLFFIGen:mlnlffigen> tool from SML/NJ to MLton. Due to low-level
12details, the code generated by SML/NJ's `ml-nlffigen` is not
13compatible with MLton, and vice-versa. However, the generated code
14has the same interface, so portable client code can be written.
15MLton'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
29MLton's <:MLBasis: ML Basis system> using `cm2mlb`, note that the
30following 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+
38This will automatically convert a `$/c.cm` import in an input `.cm`
39file into a `$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb` import in the
40output `.mlb` file.
41
42== Also see ==
43
44* <!Cite(Blume01)>
45* <:MLNLFFIImplementation:>
46* <:MLNLFFIGen:>