From nissim@math.ufl.edu Mon Jul 23 22:08:15 2001
Received: from smtp.ufl.edu (sp28fe.nerdc.ufl.edu [128.227.128.108])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f6NK8EJ05314
	for <prolog@swi.psy.uva.nl>; Mon, 23 Jul 2001 22:08:14 +0200 (MET DST)
Received: from computer (p083n135.shands.ufl.edu [10.227.83.135])
	by smtp.ufl.edu (8.11.2/8.11.3/2.2.1) with SMTP id f6NK8Bv19856
	for <prolog@swi.psy.uva.nl>; Mon, 23 Jul 2001 16:08:11 -0400
Message-ID: <003201c1138a$9567b1a0$8753e30a@computer>
From: "Nissim Broudo" <nissim@math.ufl.edu>
To: <prolog@swi.psy.uva.nl>
Date: Mon, 23 Jul 2001 16:17:24 +0100
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_002F_01C11392.F5370060"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Subject: [SWIPL] Calling SWI-Prolog from C

This is a multi-part message in MIME format.

------=_NextPart_000_002F_01C11392.F5370060
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

My name is Nissim Broudo. I am working on a project that involves =
calling SWI-Prolog from C.  Unfortunately, I haven't been able to get =
this working and I would appreciate a pointer on where I am going wrong. =
 Here is my code:

#include <stdio.h>
#include <SWI-Prolog.h>

int main()
{=20

predicate_t p;
functor_t s2;
fid_t fid;
term_t goal;

goal =3D PL_new_term_ref();

}

The variable declarations work fine, but the compiler (gcc in the Cygwin =
package, Windows NT) complains:

Undefined reference to PL_new_term_ref
collect2: ld returned 1 exit status

I'm sure gcc is finding the SWI_Prolog header file b/c it finds the =
variable declarations and becuase when I try=20

goal =3D PL_new_term_ref(1);

gcc complains:

too many arguments to function PL_new_term_ref

Please keep in mind, I am new to C programming and any pointers in the C =
programming area will be appreciated.  If you reply to the newsgroup, =
please copy me at nissim@math.ufl.edu since I haven't yet received =
confirmation that I am subscribed to the newsgroup.

Thanks in advance,

Nissim Broudo

------=_NextPart_000_002F_01C11392.F5370060
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>My name is Nissim Broudo. I am working =
on a project=20
that involves calling SWI-Prolog from C.&nbsp; Unfortunately, I haven't =
been=20
able to get this working and I would appreciate a pointer on where I am =
going=20
wrong.&nbsp; Here is my code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#include &lt;stdio.h&gt;<BR>#include=20
&lt;SWI-Prolog.h&gt;<BR></FONT><FONT face=3DArial size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>int main()<BR>{ </DIV>
<DIV>&nbsp;</DIV>
<DIV>predicate_t p;<BR>functor_t s2;<BR>fid_t fid;<BR>term_t =
goal;<BR></DIV>
<DIV>goal =3D PL_new_term_ref();</DIV>
<DIV>&nbsp;</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>The variable declarations work fine, but the compiler (gcc in the =
Cygwin=20
package, Windows NT) complains:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Undefined reference to PL_new_term_ref</DIV>
<DIV>collect2: ld returned 1 exit status</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm sure gcc is finding the SWI_Prolog header file b/c it finds the =

variable declarations and becuase when I try </DIV>
<DIV>&nbsp;</DIV>
<DIV>goal =3D PL_new_term_ref(1);</DIV>
<DIV>&nbsp;</DIV>
<DIV>gcc complains:</DIV>
<DIV>&nbsp;</DIV>
<DIV>too many arguments to function PL_new_term_ref</DIV>
<DIV>&nbsp;</DIV>
<DIV>Please keep in mind, I am new to C programming and any pointers in =
the C=20
programming area will be appreciated.&nbsp; If you reply to the =
newsgroup,=20
please copy me at <A =
href=3D"mailto:nissim@math.ufl.edu">nissim@math.ufl.edu</A>=20
since I haven't yet received confirmation that I am subscribed to the=20
newsgroup.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks in advance,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Nissim Broudo</FONT></DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_002F_01C11392.F5370060--

