The CINTERFACE signature


Synopsis

signature CINTERFACE

Interface

exception CFunNotFound of string
val c_function : string -> string -> 'a -> 'b
type c_function
val bindCFun : (string * string) -> c_function
type system_const = (int * string)
exception SysConstNotFound of string
val findSysConst : (string * system_const list) -> system_const option
val bindSysConst : (string * system_const list) -> system_const

Description

exception CFunNotFound

c_function modName funName
Look up the function "modName.funName" in the runtime system's dictionary of native-code functions, and return an ML function that interfaces to it. For improved safety, the result should be immediately cast to a particular type, as in:
            val gettimeofday : unit -> (Int32.int * int) =
	         c_function "SMLNJ-Time" "timeofday"
          


type c_function
The abstract type for pointer-to-native-code-function. Sometimes it is useful to pass values of this type to other native-code functions.

bindCFun (modName, funName)
Look up "modName.funName" in the runtime system's dictionary of native-code functions, and return pointer-to-native-code-function. Most users will want to use c_function instead, which returns an ML-callable function.

type system_const
A type typically used for making lists of (sys-error-num, sys-error-message).

exception SysConstNotFound
Exception raised by bindSysConst.

findSysConst (s, l)
If the pair (i,s) is present in l, return SOME(i,s); else return NONE.

bindSysConst (s, l)
If the pair (i,s) is present in l, return (i,s); else raise SysConstNotFound.