users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Raising Prolog exceptions from C code (2nd attempt)


From: Joseph Benden
Subject: Re: Raising Prolog exceptions from C code (2nd attempt)
Date: 07 Jun 2002 12:55:47 -0400

Hello,

The Prolog exceptions that I am successfully raising from both C and C++ code is based off of the Emit_Syntax_Error call.

Example:

Emit_Syntax_Error("SQL Error", 1, 1, "Some text that failed or another C call returning a textual error message");
Joseph Benden
Systems Development and Network Administrator
AdWriter, Inc.

Professional Member of the Association of Computing Machinery (www.ACM.org)
Professional Member of the Network and System Professionals Association (www.NaSPA.org)

On Fri, 2002-06-07 at 12:43, Roberto Bagnara wrote:
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:address@hidden


_______________________________________________
Users-prolog mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/users-prolog

    

reply via email to

[Prev in Thread] Current Thread [Next in Thread]