swi
June 6, 2019, 10:40pm
2
It could be that some memory is getting corrupted.
Try running with swipl -d chk_secure
which will enable some extra debugging/checks to see if you are corrupting a termref or something earlier in your code.
See this post:
Jan,
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_t arguments outside of the switch statement which checks if the call is PL_FIRST_CALL, PL_REDO or PL_PRUNED.
2) don’t use the term_t references inside the PL_PRUNED case.
Longer explanation:
If an exception is thrown (after th…
This page has more info also:
http://www.swi-prolog.org/pldoc/man?section=foreign-debug