11.3.83 foreign_resource/2 [hook]

Synopsis

:- discontiguous foreign_resource/2.

foreign_resource(+ResourceName, +ForeignFunctions)

Describes the foreign functions in ResourceName to interface to.

Arguments

ResourceName
atom, must be nonvar
ForeignFunctions
list of atom, must be ground

A list of foreign function symbols that will be obtained from ResourceName.

Description

The user has to define a foreign_resource/2 fact for every foreign resource that is to be loaded into Prolog. The ForeignFunctions gives the list of foreign symbols that are to be found in the given foreign resource. When a foreign resource is loaded using load_foreign_resource/1, Prolog looks for a foreign_resource/2 fact for that foreign resource and finds the address of each symbol listed in that fact. Prolog also expects a foreign/[2,3] definition for each symbol in the second argument of that fact.

The foreign_resource/2 facts are used only in the context of a load_foreign_resource/1 command and can be removed once the foreign resource has been loaded.

Contrary to most hook predicates which reside in the user module, load_foreign_resource/1 will look for foreign_resource/2 facts defined in its source module.

See Also

load_foreign_resource/1, foreign/[2,3], Calling C from Prolog.


Send feedback on this subject.