In addition to the functions described in
section 12.4.4.2,
there is a family of functions that is used for automatic generation of
wrapper functions, for example using the Prolog library library(qpforeign)
that provides a Quintus/SICStus compatible foreign language interface.
The PL_cvt_i_*() family of functions is suitable for use with a
_Generic
selector or C++ overloading.222_Generic
needs to take into account that there's no bool
type in C
but there is in C++. An overloaded integer() method is provided
in the C++ interface.
Note that the documentation on this API is incomplete. Also note that many of these functions are equivalent to the PL_get_*_ex() functions described in section 12.4.7.
int
because C has no bool
type. The return
value is either 0
or 1
.FALSE
if the conversion is
impossible because the Prolog term is not an integer or the C type
cannot represent the value of the Prolog integer.