:- discontiguous foreign/2, foreign/3.
Describes the interface between Prolog and the foreign Routine.
An atom that names a foreign code Routine.
An atom that names the Language
in which Routine is written. Can only be
A ground term of the form PredName(Argspec, ..., Argspec) as described in Conversions between Prolog Arguments and C Types. Each Argspec should be a foreign_arg.
The user has to define a
foreign/[2,3] fact for every foreign function that
is to be called from Prolog. Note that Routine does not have to be
the same as PredicateName. Arguments are passed to the foreign function
as specified in ForeignSpec.
foreign/[2,3] facts are used only in the context of a
and can be removed once the foreign files are loaded.
Contrary to most hook predicates which reside in the
foreign/[2,3] facts will only be looked up
in the source module of the loading command.
Error handling is performed by
load_foreign_resource/1, Calling C from Prolog.