Bugzilla – Bug 41
swi-prolog overrides all assertions by defining __assert_fail
Last modified: 2012-06-27 17:14:29 CEST
The swipl dynamic library defines the glibc function __assert_fail. This has
the effect that all assertion failures in a program linked to the swipl library
are handled by swipl's assertion failure handler. See:
This is a problem, because if an assertion failure occurs in a program
embedding SWI-Prolog while the prolog engine is not initialized, the assert
handler will call PL_thread_self(), which will crash.
A possible solution is for SWI-Prolog to use its own assert macro internally
which does whatever it needs to do (and which is only used when the engine is
initialized), and leave the normal assert() behavior unchanged.