From jan@swi.psy.uva.nl Tue Jul 24 10:40:08 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f6O8e8J15239;
	Tue, 24 Jul 2001 10:40:08 +0200 (MET DST)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f6O8e6F11912;
	Tue, 24 Jul 2001 10:40:06 +0200
Date: Tue, 24 Jul 2001 10:40:06 +0200
Message-Id: <200107240840.f6O8e6F11912@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: [SWIPL] Calling SWI-Prolog from C
To: "Nissim Broudo" <nissim@math.ufl.edu>, <prolog@swi.psy.uva.nl>
In-Reply-To: Nissim Broudo's message of Mon, 23 Jul 2001 16:17:24 +0100
Phone: +31 - 20 - 525 6121

> 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

On windows (actually on COFF based systems you need to link to libpl.dll.
Note that cygwin and MSVC don't mix too well.  Though a bit simplified,
you can only use cygwin if you recompile SWI-Prolog based on Cygwin.
Otherwise you need MSVC.  See README.cygwin in the sources.
	
	--- Jan

