foreign_file/2 hook

Synopsis

:- discontiguous foreign_file/2.

foreign_file(+ObjectFile, +ForeignFunctions)

Describes the foreign functions in ObjectFile to interface to. The user has to define a foreign_file/2 fact for every object file that is to be loaded into Prolog.

Arguments


ObjectFile file_spec
The foreign object file
ForeignFunctions list of atom
A list of foreign function symbols that will be obtained from ObjectFile.

Description

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

For more details about the foreign interface, see fli-p2f-uso-ffi.

The foreign_file/2 facts are used only in the context of a load_foreign_files/2 command and can be removed once the foreign files are loaded.

If you have foreign_file/2 facts in different files, Prolog will warn you that foreign_file/2 has been previously defined in another file.

load_foreign_files/2 will only look for foreign_file/2 facts defined in its source module.

Exceptions

Errors in the specification of foreign_file/2 will only be detected when load_foreign_files/2 is called. Otherwise defining a foreign_file/2 fact is just like defining any other Prolog fact.

Examples

See example under foreign/[2,3].

Tips

See Tip under foreign/[2,3]

See Also

load_foreign_files/2, foreign/[2,3]