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 ; 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 ; Tue, 24 Jul 2001 04:03:18 -0400 Message-ID: <001401c113ee$67772410$8f53e30a@computer> From: "Nissim Broudo" To: 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 #include 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
Dear All,
 
I managed to solve my own = problem.  I compile=20 with:
 
gcc -I"C:\Program Files\pl\include" = -L"C:\Program=20 Files\pl\bin" -lpl myprog.c
 
This was a hard-won discovery for a = novice C=20 programmer like myself !
 
Although my problem is soved, I would = welcome=20 any suggestions from you all.
 
Thanks,
 
Nissim Broudo
 
 
----- Original Message -----
From:=20 Nissim=20 Broudo
Sent: Monday, July 23, 2001 = 4:17 PM
Subject: [SWIPL] Calling = SWI-Prolog from=20 C

My name is Nissim Broudo. I am = working on a=20 project that involves calling SWI-Prolog from C.  Unfortunately, = I=20 haven't been able to get this working and I would appreciate a pointer = on=20 where I am going wrong.  Here is my code:
 
#include <stdio.h>
#include=20 <SWI-Prolog.h>
int main()
{
 
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=20 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=20 variable declarations and becuase when I try
 
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=20 programming area will be appreciated.  If you reply to the = newsgroup,=20 please copy me at nissim@math.ufl.edu=20 since I haven't yet received confirmation that I am subscribed to the=20 newsgroup.
 
Thanks in advance,
 
Nissim = Broudo
------=_NextPart_000_0011_01C113F6.C7063580--