## MLton 20241230+git20251029+dfsg-5

# MLNLFFI

ML-NLFFI is the no-longer-foreign-function interface library for SML.

As of 20050212, MLton has an initial port of ML-NLFFI from SML/NJ to MLton. All of the ML-NLFFI functionality is present.

Additionally, MLton has an initial port of the mlnlffigen tool from SML/NJ to MLton. Due to low-level details, the code generated by SML/NJ’s `ml-nlffigen` is not compatible with MLton, and vice-versa. However, the generated code has the same interface, so portable client code can be written. MLton’s `mlnlffigen` does not currently support C functions with `struct` or `union` arguments.

## Usage

- You can import the ML-NLFFI Library into an MLB file with

  MLB file | Description
  --- | ---
  `$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb` |

- If you are porting a project from SML/NJ’s CompilationManager to MLton’s ML Basis system using `cm2mlb`, note that the following maps are included by default:

      # MLNLFFI Library
      $c                                      $(SML_LIB)/mlnlffi-lib
      $c/c.cm                                 $(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb

  This will automatically convert a `$/c.cm` import in an input `.cm` file into a `$(SML_LIB)/mlnlffi-lib/mlnlffi-lib.mlb` import in the output `.mlb` file.

## Also see

- Blume01

- MLNLFFIImplementation

- MLNLFFIGen