This chapter explains issues for writing portable Prolog programs. It was started after discussion with Vitor Santos Costa, the leading developer of YAP Prolog179http://yap.sourceforge.net/ YAP and SWI-Prolog have expressed the ambition to enhance the portability beyond the trivial Prolog examples, including complex libraries involving foreign code.
Although it is our aim to enhance compatibility, we are still faced
with many incompatibilities between the dialects. As a first step both
YAP and SWI will provide some instruments that help developing portable
code. A first release of these tools appeared in SWI-Prolog 5.6.43. Some
of the facilities are implemented in the base system, others in the
swifor SWI-Prolog and
swi(Major, Minor, Patch, Extra)
:- endifis supported. See section 188.8.131.52.
__SWI_PROLOG__when compiled for SWI-Prolog and
__YAP_PROLOG__when compiled on YAP.
The exact behaviour of this predicate is still subject to discussion.
Of course, if Dialect matches the running dialect the
directive has no effect. Otherwise we check for the existence of
library(dialect/Dialect) and load it if the file is found.
Currently, this file has this functionality: