Thank you so much for providing
swipl -d chk_secure, without it, it would have been almost impossible to debug an error in my foreign code!
Two warnings for all those who are doing non deterministic foreign predicates:
- don’t write code that references the
term_targuments outside of the
switchstatement which checks if the call is
- don’t use the
term_treferences inside the
If an exception is thrown (after the foreign predicate returned with one of
term_t arguments are not valid anymore, and the the function is called again with
control_t call type set to
PL_PRUNED (this is needed to cleanup memory).
If you have code that uses the
term_ts it will crash the system, eventually causing the garbage collector will bail out with a segfault.