Foreign Language Interface Builder
Author(s): Jose F. Morales, Manuel Carro.
Low-level utilities for building foreign interfaces. End-users should not need to use them, as the Ciao Prolog Compiler reads the user assertions and calls appropriately the predicates in this module.
Usage and interface
- Library usage:
:- use_module(library(build_foreign_interface)). - Exports:
- Imports:
- System library modules:
write_c/write_c, streams, terms, lists, llists, aggregates, system, messages, assertions/assrt_lib, foreign_compilation, compiler/c_itf, compiler/engine_path, ctrlcclean, errhandle, filenames. - Packages:
prelude, nonpure, assertions, basicmodes, dcg, fsyntax.
- System library modules:
Documentation on exports
Usage:build_foreign_interface(File)
Reads assertions from File, generates the gluecode for the Ciao Prolog interface, compiles the foreign files and the gluecode file, and links everything in a shared object. Checks modification times to determine automatically which files must be generated/compiled/linked.
- Call and exit should be compatible with:
(streams_basic:sourcename/1)File is a source name. - The following properties should hold at call time:
(term_typing:ground/1)File is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)File is currently ground (it contains no variables).
Usage:rebuild_foreign_interface(File)
Like build_foreign_interface/1, but it does not check the modification time of any file.
- Call and exit should be compatible with:
(streams_basic:sourcename/1)File is a source name. - The following properties should hold at call time:
(term_typing:ground/1)File is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)File is currently ground (it contains no variables).
Usage:build_foreign_interface_explicit_decls(File,Decls)
Like build_foreign_interface/1, but use declarations in Decls instead of reading the declarations from File.
- Call and exit should be compatible with:
(streams_basic:sourcename/1)File is a source name.
(basic_props:list/2)Decls is a list of terms. - The following properties should hold at call time:
(term_typing:ground/1)File is currently ground (it contains no variables).
(term_typing:ground/1)Decls is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)File is currently ground (it contains no variables).
(term_typing:ground/1)Decls is currently ground (it contains no variables).
Usage:rebuild_foreign_interface_explicit_decls(File,Decls)
Like build_foreign_interface_explicit_decls/1, but it does not check the modification time of any file.
- Call and exit should be compatible with:
(streams_basic:sourcename/1)File is a source name.
(basic_props:list/2)Decls is a list of terms. - The following properties should hold at call time:
(term_typing:ground/1)File is currently ground (it contains no variables).
(term_typing:ground/1)Decls is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)File is currently ground (it contains no variables).
(term_typing:ground/1)Decls is currently ground (it contains no variables).
Usage:build_foreign_interface_object(File)
Compiles the gluecode file with the foreign source files producing an unique object file.
- Call and exit should be compatible with:
(streams_basic:sourcename/1)File is a source name. - The following properties should hold at call time:
(term_typing:ground/1)File is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)File is currently ground (it contains no variables).
Usage:rebuild_foreign_interface_object(File)
Compiles (again) the gluecode file with the foreign source files producing an unique object file.
- Call and exit should be compatible with:
(streams_basic:sourcename/1)File is a source name. - The following properties should hold at call time:
(term_typing:ground/1)File is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)File is currently ground (it contains no variables).
Usage:do_interface(Decls)
Given the declarations in Decls, this predicate succeeds if these declarations involve the creation of the foreign interface
- Call and exit should be compatible with:
(basic_props:list/2)Decls is a list of terms. - The following properties should hold at call time:
(term_typing:ground/1)Decls is currently ground (it contains no variables). - The following properties should hold upon exit:
(term_typing:ground/1)Decls is currently ground (it contains no variables).