- Documentation
- Reference manual
- Foreign Language Interface
- The Foreign Include File
- Argument Passing and Control
 - Atoms and functors
 - Input and output
 - Analysing Terms via the Foreign Interface
 - Constructing Terms
 - Unifying data
 - Convenient functions to generate Prolog exceptions
 - Foreign language wrapper support functions
 - Serializing and deserializing Prolog terms
 - BLOBS: Using atoms to store arbitrary binary data
 - Exchanging GMP numbers
 - Calling Prolog from C
 - Discarding Data
 - String buffering
 - Foreign Code and Modules
 - Prolog exceptions in foreign code
 - Catching Signals (Software Interrupts)
 - Miscellaneous
 - Errors and warnings
 - Environment Control from Foreign Code
 - Querying Prolog
 - Registering Foreign Predicates
 - Foreign Code Hooks
 - Storing foreign data
 - Embedding SWI-Prolog in other applications
 
 
 - The Foreign Include File
 
 - Foreign Language Interface
 - Packages
 
 - Reference manual
 
12.4.8 Foreign language wrapper support functions
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.
- bool PL_cvt_i_bool(term_t p, int *c)
 - Equivalent to PL_get_bool_ex(). 
Note that the pointer is to an
intbecause C has nobooltype. The return value is either0or1. - bool PL_cvt_i_char(term_t p, char *c)
 - bool PL_cvt_i_schar(term_t p, signed char *c)
 - bool PL_cvt_i_uchar(term_t p, unsigned char *c)
 - bool PL_cvt_i_short(term_t p, short *s)
 - bool PL_cvt_i_ushort(term_t p, unsigned short *s)
 - bool PL_cvt_i_int(term_t p, int *c)
 - bool PL_cvt_i_uint(term_t p, unsigned int *c)
 - bool PL_cvt_i_long(term_t p, long *c)
 - bool PL_cvt_i_ulong(term_t p, unsigned long *c)
 - bool PL_cvt_i_llong(term_t p, long long *c)
 - bool PL_cvt_i_ullong(term_t p, unsigned long long *c)
 - bool PL_cvt_i_int32(term_t p, int32_t *c)
 - bool PL_cvt_i_uint32(term_t p, uint32_t *c)
 - bool PL_cvt_i_int64(term_t p, int64_t *c)
 - bool PL_cvt_i_uint64(term_t p, uint64_t *c)
 - bool PL_cvt_i_size_t(term_t p, size_t *c)
 - Convert a Prolog integer into a C integer of the specified size. 
Generate an exception and return 
FALSEif the conversion is impossible because the Prolog term is not an integer or the C type cannot represent the value of the Prolog integer.