From nissim@math.ufl.edu Tue Jul 24 10:03:23 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 f6O83MJ13400
	for <prolog@swi.psy.uva.nl>; Tue, 24 Jul 2001 10:03:22 +0200 (MET DST)
Received: from computer (p083n143.shands.ufl.edu [10.227.83.143])
	by smtp.ufl.edu (8.11.2/8.11.3/2.2.1) with SMTP id f6O83Hv57504
	for <prolog@swi.psy.uva.nl>; Tue, 24 Jul 2001 04:03:18 -0400
Message-ID: <001401c113ee$67772410$8f53e30a@computer>
From: "Nissim Broudo" <nissim@math.ufl.edu>
To: <prolog@swi.psy.uva.nl>
References: <003201c1138a$9567b1a0$8753e30a@computer>
Subject: Re: [SWIPL] Calling SWI-Prolog from C
Date: Tue, 24 Jul 2001 04:11:56 +0100
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0011_01C113F6.C7063580"
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

This is a multi-part message in MIME format.

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

Dear All,

I managed to solve my own problem.  I compile with:

gcc -I"C:\Program Files\pl\include" -L"C:\Program Files\pl\bin" -lpl =
myprog.c

This was a hard-won discovery for a novice C programmer like myself !

Although my problem is soved, I would welcome any suggestions from you =
all.

Thanks,

Nissim Broudo


  ----- Original Message -----=20
  From: Nissim Broudo=20
  To: prolog@swi.psy.uva.nl=20
  Sent: Monday, July 23, 2001 4:17 PM
  Subject: [SWIPL] Calling SWI-Prolog from C


  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_0011_01C113F6.C7063580
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>Dear All,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I managed to solve my own =
problem.&nbsp; I compile=20
with:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>gcc -I"C:\Program Files\pl\include" =
-L"C:\Program=20
Files\pl\bin" -lpl myprog.c</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This was a hard-won discovery for a =
novice C=20
programmer like myself !</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Although my problem is soved, I would =
welcome=20
any&nbsp;suggestions from you all.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Nissim Broudo</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Dnissim@math.ufl.edu =
href=3D"mailto:nissim@math.ufl.edu">Nissim=20
  Broudo</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dprolog@swi.psy.uva.nl=20
  href=3D"mailto:prolog@swi.psy.uva.nl">prolog@swi.psy.uva.nl</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, July 23, 2001 =
4:17 PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [SWIPL] Calling =
SWI-Prolog from=20
  C</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>
  <DIV><FONT face=3DArial size=3D2>My name is Nissim Broudo. I am =
working on a=20
  project that involves calling SWI-Prolog from C.&nbsp; Unfortunately, =
I=20
  haven't been able to get this working and I would appreciate a pointer =
on=20
  where I am going 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=20
  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></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0011_01C113F6.C7063580--

