next up previous
Next: Overview of the Up: No Title Previous: Compatibility of the

Foreign Language Interface

SWI-Prolog offers a powerful interface to C [Kernighan & Ritchie, 1978]. The main design objectives of the foreign language interface are flexibility and performance. Most Prolog foreign language interfaces allow the user only to pass primitive data through the interface. The user should normally specify for each argument whether it is an input or output argument as well as the type of the argument. Because type checking and conversion to/from C data types is done by Prolog the actual foreign code is usually short if something simple is wanted. The SWI-Prolog interface does not offer these primitives. Instead Prolog terms in their internal representation are passed via the interface. This allows the user to write `logical' predicates and pass arbitrary Prolog data over the interface. As a trade-off the user is responsible for type checking and should be careful not to violate consistency rules as Prolog provides access to its internal data structures.





Passani Luca
Tue Nov 14 08:58:33 MET 1995