The following table lists the possible values for the arguments in
the predicate specification of foreign/[2,3]. The value
declares which conversion between corresponding Prolog argument
and C type will take place.
Prolog: +integerC: SP_integerSP_integer and passed to the C function.
Prolog: +floatC: doubledouble and
passed to the C function.
Prolog: +atomC: SP_atomProlog: +codesC: char const *Prolog: +stringC: char const *Prolog: +addressC: void *void * pointer.
Prolog: +address(TypeName)C: TypeName * * pointer.
Prolog: +termC: SP_term_refProlog: -integerC: SP_integer *SP_integer.
The value returned will be converted to a Prolog integer.
Prolog: -floatC: double *double.
The value returned will be converted to a Prolog float.
Prolog: -atomC: SP_atom *SP_atom.
The value returned should be the canonical representation of a
Prolog atom.
Prolog: -codesC: char const **char *.
The returned encoded string will be converted to a Prolog code-list.
Prolog: -stringC: char const **char *.
The returned encoded string will be converted to a Prolog atom. Prolog
will copy the string to a safe place, so the memory occupied by the
returned string may be reused during subsequent calls to foreign
code.
Prolog: -addressC: void **void *.
Prolog: -address(TypeName)C: TypeName ** *.
Prolog: -termC: SP_term_refProlog: [-integer]C: SP_integer F()SP_integer. The value returned will be
converted to a Prolog integer.
Prolog: [-float]C: double F()double. The value returned will
be converted to a Prolog float.
Prolog: [-atom]C: SP_atom F()SP_atom. The value
returned must be the canonical representation of a Prolog atom.
Prolog: [-codes]C: char const *F()char *. The returned encoded
string will be converted to a Prolog code-list.
Prolog: [-string]C: char const *F()char *. The returned encoded
string will be converted to a Prolog atom. Prolog will copy the string
to a safe place, so the memory occupied by the returned string may be
reused during subsequent calls to foreign code.
Prolog: [-address]C: void *F()void *, which will be converted to a Prolog integer.
Prolog: [-address(TypeName)]C: TypeName *F() *.
Prolog: [-term]C: SP_term_ref F()