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.


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

    MLB file Description


  • 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/                                 $(SML_LIB)/mlnlffi-lib/

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

Also see