[PPL-devel] Raising Prolog exceptions from C code (2nd attempt)

Roberto Bagnara bagnara at cs.unipr.it
Fri Jun 7 18:43:35 CEST 2002


Hi there,

I am repeating here a question I have already asked on April 10 and that
remained unanswered (sorry about that, but I am stuck).
What is the recommended way to raise a Prolog exception from foreign C code?
Is it

      Pl_Exec_Continuation(Find_Atom("throw"), 1, &t)

where t is any variable of type PlTerm?
The manual seems to suggest that, but I would like to know for sure.
Moreover, even though the simple examples work without problems,
trying to raise an exception this way from a rather complex C++
library almost always results in segmentation violations or
illegal instructions being executed.  And gdb does not seem
to be of much help debugging that.  Perhaps the Pl_Exec_Continuation
technique works only under certain circumstances, but which ones?
Is anybody out there raising exceptions from C++ code?
Thanks a lot

       Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it




More information about the PPL-devel mailing list