11.3.84 foreign_resource/2   hook


:- discontiguous foreign_resource/2.

foreign_resource(+ResourceName, +ForeignFunctions)

Describes the foreign functions in ResourceName to interface to.



atom, must be nonvar


list of atom, must be ground

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


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.


Error handling is performed by load_foreign_resource/1.

See Also

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

Send feedback on this subject.