Docs GODI Archive
Projects Blog Knowledge

Look up function:

(e.g. "List.find" or "keysym")
More options

Chapter 5. Complex packages

The standard predicates

Settings in the META file have usually the form:

varname ( predname1, predname2, ... ) = "value"

The names in the parantheses are called formal predicates and express a condition which must hold such that the value on the right side is selected. When querying information you can specify a set of actual predicates that are assumed to be true. There are the following standard predicates:

  • The "byte" predicate means that the bytecode compiler is used.

  • The "native" predicate means that the native compiler is used.

  • The "toploop" predicate means that the toploop is available in the linked program.

  • The "mt" predicate means that the program is multi-threaded.

  • The "mt_posix" predicate means that in the case "mt" is set, too, the POSIX libraries are used to implement threads.

  • The "mt_vm" predicate means that in the case "mt" is set, too, the VM-based libraries are used to implement threads.

  • The "gprof" predicate means that in the case "native" is set, too, the program is compiled for profiling

  • The "autolink" predicate indicates that ocamlc is able to perform automatic linking.

It is possible to have more predicates indicating different environments; just use them, it is not necessary to declare them anywhere.

The value which is selected for a variable depends on the set of assumed predicates. In order to get selected, all formal predicates must be included in the set of actual predicates; if still multiple values fulfill this condition, the value with the maximum number of formal predicates is used; and if still in doubt, the first of these in the META file is taken.

It is possible to negate a formal predicate: Just prepend a minus sign to it, e.g. var(p,-q). In this case, it is required that the negated predicates are false (not contained in the set of actual predicates).

For all variables that are evaluated after the dependency analysis, findlib adds the so-called package predicates to the set of actual predicates. For every selected package p the predicate pkg_p (with the fixed prefix "pkg_") is added. One application of this are compatibility checks: The special error variable is evaluated after dependency analysis, but before anything else is done. For example, to state that package p is incompatible with package q one can add to the META file of p:

error(pkg_q) = "Package p is incompatible with q"
The value of error is printed as message in the case the condition is true.
This web site is published by Informatikb√ľro Gerd Stolpmann
Powered by Caml