Please try last version at:
ftp://ftp.inria.fr/INRIA/Projects/contraintes/gprolog/unstable/gprolog-20040608.tgz
John Badcock wrote:
The possible bug relates to the "calling C from prolog" example in Section 9.1.8 of the manual, edition 1.7.
Type of machine: Linux localhost.localdomain 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux
GNU Prolog version: Prolog top-Level (GNU Prolog) 1.2.16
Files are from the example in section 9.1.8 of the manual, p. 187.
examp.pl contains:
:- foreign(first_occurrence(+string,+char,-positive)).
examp_c.c contains:
#include <string.h> #include "gprolog.h"
Bool first_occurrence(char *str, long c, long *pos) { char *p;
p = strchr(str, c); if (p == NULL) /* C does not appear in A */ return FALSE; /* fail */
*pos = p - str; /* set the output argument */ return TRUE; /* succeed */ }
Compilation as suggested in the manual produces:
[EMAIL PROTECTED] GProlog]$ gplc examp.pl examp_c.c /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(atom_c.o)(.text+0x1136): In function `Lower_Upper_2': : undefined reference to `__ctype_toupper' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(atom_c.o)(.text+0x1177): In function `Lower_Upper_2': : undefined reference to `__ctype_tolower' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(le_interf_c.o)(.text+0x7b): In function `Add_Linedit_Completion_1': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(pred_supp.o)(.text+0xc4): In function `Father_Pred_Of_Aux': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(pred_supp.o)(.text+0x170): In function `Detect_If_Aux_Name': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(parse_supp.o)(.text+0x4c6): In function `Parse_Term': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(write_supp.o)(.text+0x50f): In function `Show_Atom': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(scan_supp.o)(.text+0xa86): more undefined references to `__ctype_b' follow /usr/lib/gprolog-1.2.16/lib/liblinedit.a(linedit.o)(.text+0x10f6): In function `LE_FGets': : undefined reference to `__ctype_tolower' /usr/lib/gprolog-1.2.16/lib/liblinedit.a(linedit.o)(.text+0x1225): In function `LE_FGets': : undefined reference to `__ctype_toupper' /usr/lib/gprolog-1.2.16/lib/liblinedit.a(linedit.o)(.text+0x1cee): In function `LE_Get_Key': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/liblinedit.a(terminal.o)(.text+0x250): In function `Parse_Env_Var': : undefined reference to `__ctype_b' /usr/lib/gprolog-1.2.16/lib/liblinedit.a(terminal.o)(.text+0x602): In function `LE_Get_Char': : undefined reference to `__ctype_b' collect2: ld returned 1 exit status compilation failed
If the identically-named files and Makefile supplied in ExamplesC are used instead,
make produces the same undefined references.
The undefined references are similar to those reported by Chris Nettleton on 17 Mar 2005,
for a âHello worldâ program.
Following a suggestion regarding undefined references (Daniel Diaz, users-prolog, 25 Jan 2001) a -v option was added for linking, using the following makefile and the short examp files listed earlier.
examp: examp.o examp_c.o gplc -v examp.o examp_c.o -o examp examp.o: examp.pl gplc -c examp.pl examp_c.o: examp_c.c gplc -c examp_c.c
This produced the following:
gcc -o examp /usr/lib/gprolog-1.2.16/lib/obj_begin.o examp.o examp_c.o /usr/lib/gprolog-1.2.16/lib/all_pl_bips.o /usr/lib/gprolog-1.2.16/lib/all_fd_bips.o /usr/lib/gprolog-1.2.16/lib/top_level.o /usr/lib/gprolog-1.2.16/lib/debugger.o /usr/lib/gprolog-1.2.16/lib/libbips_fd.a /usr/lib/gprolog-1.2.16/lib/libengine_fd.a /usr/lib/gprolog-1.2.16/lib/libbips_pl.a /usr/lib/gprolog-1.2.16/lib/obj_end.o /usr/lib/gprolog-1.2.16/lib/libengine_pl.a /usr/lib/gprolog-1.2.16/lib/liblinedit.a -lm /usr/lib/gprolog-1.2.16/lib/libbips_pl.a(atom_c.o)(.text+0x1136): In function `Lower_Upper_2': : undefined reference to `__ctype_toupper'
etc as above.
Thank you in advance for any advice you can offer. John.
_______________________________________________ Bug-prolog mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-prolog
