users-prolog
[Top][All Lists]
Advanced

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

Crash when calling Prolog from C


From: Udi Kalifon
Subject: Crash when calling Prolog from C
Date: Thu, 26 Sep 2002 13:28:40 -0400 (EDT)

I am writing an extension for GNU Prolog to be able to build Prolog 
applications with a GUI using the Tk toolkit. I am having problems with 
Pl_Query_Call. Whenever an event occurs, and my foreign function tries to use 
Pl_Query_Call to calls a Prolog term to receive the event, I get an error:

   Fatal Error: Segmentation Violation


The following is my code that does the callback (it accepts a lot of parameters 
from Tcl but they are ignored except for the last one):

int tk_Callback (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *CONST 
objv[])
{
        PlTerm Term, *Args=NULL;
        int functor=0, arity=0;
        
        Term = Mk_String(Tcl_GetString(objv[1]));
        Args = Rd_Callable_Check(Term, &functor, &arity);
        
        Pl_Query_Begin(0);
        Pl_Query_Call(functor, arity, Args);    // Register now!





reply via email to

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