users-prolog
[Top][All Lists]
Advanced

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

RE: C/C++ predicates for GNU-Prolog, help!


From: Joseph Benden
Subject: RE: C/C++ predicates for GNU-Prolog, help!
Date: Tue, 8 Jan 2002 09:17:40 -0500

Included are two files below.  One is in C, the second is a foreign
statement.  The command line used to compile is:

gplc segfault.pl segfault_c.c

When executed in 1.2.1, the application works with no problems.  Under the
newer versions, it always seg. faults.

The two tests are:

segfault(no,A).           <--- This does NOT seg. fault
segfault(yes,A).                  <--- This DOES seg. fault


----- segfault_c.c -------

#include <gprolog.h>
#include <stdlib.h>

Bool segfault( char *in, PlTerm out )
{
        if( strcmp(in,"yes") == 0 ) {
                printf("Calling system error\n");
                Pl_Err_System(Create_Atom("segfault_system_error_test"));
                printf("return\n");
                return FALSE;
        } else {
                printf("unifying\n");
                Un_String_Check("Hello, World!", out);
                printf("return\n");
                return TRUE;
        }
        return FALSE;
}



----- segfault.pl --------

:- foreign(segfault(+string,+term)).

----- END ----------------


I hope this helps!

Joseph Benden
Systems Development/Network Administrator
AdWriter, Inc.



-----Original Message-----
From: address@hidden [mailto:address@hidden
Sent: Tuesday, January 08, 2002 6:03 AM
To: address@hidden
Cc: address@hidden
Subject: Re: C/C++ predicates for GNU-Prolog, help!


Hi Joseph,
this is an important information. Could you extract a piece of C and PL code
that we could use to
reproduce the bug ? Without this it is difficult to find where the problem
comes from and thus to
fix it. So a Prolog + a C (not C++ if possible) source and and example of
query (together with
instructions to compile) would be greatly appreciated...

> Joseph Benden wrote:
>
> I have a bunch of predicates which work fine under version 1.2.1 of
GNU-Prolog, but under 1.2.8 or
> 1.2.9 they always seg. fault.
>
> This occurs on Linux as well as Windows.
>
> I have narrowed it down to the Pl_Err_System, and sometime unification
calls.
>
> What has changed????? Help!

--
Daniel Diaz   address@hidden
http://pauillac.inria.fr/~diaz
gprolog --version 2>&1 | sed -n -e 's/By //p'




reply via email to

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