Subject: [SWIPL] PL_unify

From: "Nissim Broudo" <[email-masked]>
Date: Mon, 30 Jul 2001 12:24:56 +0100

I'm calling SWI-Prolog from C.  I need to use the bindings produced by one query in the input to a second query and I am encountering a problem.  I am using PL_unify.  The problem I am encountering is in a call like this:

foreign_t my_query(term_t in) {

int rval;
term_t temp;
char *st = "atom_string";
PL_unify_atom_chars(temp, st);
rval = PL_unify(temp,in);

return rval; }

Prolog reports an error:

1 ?- my_query(X).

ERROR: my_query/1: Caught signal 11 (segv)

But if I use the following:

foreign_t my_query(term_t in) {

int rval;
term_t temp;
char *st = "atom_string";
PL_unify_atom_chars(in, st);

return rval; }

Prolog reports:

X = atom_string

Any ideas ?

Thanks,
Nissim Broudo