2.18.4 Status and compiler versions (version 2)
The current interface is entirely defined in the .h
file
using inlined code. This approach has a few advantages: as no C++ code
is in the Prolog kernel, different C++ compilers with different
name-mangling schemas can cooperate smoothly.
Also, changes to the header file have no consequences to binary compatibility with the SWI-Prolog kernel. This makes it possible to have different versions of the header file with few compatibility consequences.
As of 2022-11, some details remain to be decided, mostly to do with
encodings. A few methods have a PlEncoding
optional
parameter (e.g., PlTerm::as_string()), but this hasn't yet been
extended to all methods that take or return a string. Also, the details
of how the default encoding is set have not yet been decided.
As of 2022-11, the various error convenience classes do not fully
match what the equivalent C functions do. That is,
throw PlInstantiationError(A1)
does not result in the same
context and traceback information that calling that would happen from PL_instantiation_error(A1.C_);
throw PlFail()
. See section
2.18.2.