Including and using gprolog.h

### 9.2 Including and using `gprolog.h`

The C code should include `gprolog.h` which provides a set of C definitions (types, macros, prototypes) associated to the API. Include this files as follows:

      #include <gprolog.h>

If the installation has been correctly done nothing else is needed. If the C compiler/preprocessor cannot locate `gprolog.h` pass the C compiler option required to specify an additional include directory (e.g.`-Iinclude_dir`) to `gplc` as follows (section 3.4.3):

  `% gplc -C -I`include_dir ...

The file `gprolog.h` declares the C boolean type `PlBool` as an integer and the constants `PL_FALSE` (i.e. 0) and `PL_TRUE` (i.e. 1).

New in GNU Prolog 1.3.1 and backward compatibility issues: in GNU Prolog 1.3.1 the API has been modified to protect namespace. The name of public functions, macros, variables and types are now prefixed with `Pl_`, `PL_` or `pl_`. All these prefixes should be avoided by the foreign C-code to prevent name clashes. To ensure a backward compatibility, the names used by the old API are available thanks to a set of `#define`. However, this deprecated API should not be used by recent code. It is also possible to prevent the definition of the compatibility macros using:

      #define __GPROLOG_FOREIGN_STRICT__
      #include <gprolog.h>

In addition, `gprolog.h` defines a set of macros:

- `__GPROLOG__`, `__GPROLOG_MINOR__` and `__GPROLOG_PATCHLEVEL__`. Their values are the major version, minor version, and patch level of GNU Prolog, as integer constants. For example, GNU Prolog 1.3.2 will define `____GPROLOG__` to 1, `____GPROLOG_MINOR__` to 3, and `____GPROLOG_PATCHLEVEL__` to 2.

  If you need to write code which depends on a specific version, you must be more careful. Recall these macros appeared in GNU Prolog 1.3.1 (undefined before), each time the minor version is increased, the patch level is reset to zero; each time the major version is increased (which happens rarely), the minor version and patch level are reset.

- `__GPROLOG_VERSION__`: the version as an integer defined as follows: major * 10000 + minor * 100 + patch level. For example: version 1.3.2 will result in the value 10302.
- `PL_PROLOG_NAME`: a C constant string (generally `"GNU Prolog"`).
- `PL_PROLOG_VERSION`: a C constant string associated to the version (e.g. `"1.3.1"`).
- `PL_PROLOG_DATE`: a C constant string associated with the date of this version (e.g. `"Oct 10 2008"`.
- `PL_PROLOG_COPYRIGHT`: a C constant string associated with the copyright of this version (e.g. `"Copyright (C) 1999-2008 Daniel Diaz"`.

Note the above `PL_PROLOG_`... macros are also accessible via Prolog flags thanks to the built-in predicate `current_prolog_flag/2` (section 7.22.2)

Copyright (C) 1999-2009 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright