next up previous index
Next: C-Prolog Compatibility Package Up: Libraries Previous: Perfmeter

Conditional Compilation

   

This library, when loaded with

:- lib(ifdef).
makes it possible to use primitives for conditional compilation in Prolog source files. After loading the library, the predicate ifdef/1   becomes global.

The compiler will then recognise conditional compilation directives which have the form

:- ifdef Condition1.
<compile if Condition1 is true>
:- elseif Condition2.
<compile if Condition2 is true>
..
:- else.                % or :- else(Goal), Goal is ignored
<compile if none of the above conditions holds>
:- endif.               % or :- endif(Goal), Goal is ignored
The elseif and else parts can be omitted.

Note that this mechanism is implemented using the predicate compile_term/1 and so all procedures that are conditionally compiled have no associated source file, and so

get_flag(Proc, source_file, File).
will fail. Note also that if several streams are opened to the file being compiled, the result of the compilation may not be correct.



Micha Meier
Mon Mar 4 12:11:45 MET 1996