_Import special form

The following special form converts a C function pointer to SML# function.

exp : _import (ty1, ..., tyn) -> ty
where
  • exp is a C pointer expression of type unit ptr obtained by DynamicLink.dlsym,
  • (ty1, ..., tyn) specifies the types of the arguments. The number and the types must agree with those of C function specification.
  • ty is the type of return value.

This is a shorthand for the following more primitive _ffiapply special form:

fn (x1,...,xn) => _ffiapply exp (x1:ty1, ..., xn:tyn) : ty
Last modified:2007/03/29 13:33:08
Keyword(s):
References:[Foreign Function Binding]