Subject: [clisp-list] FFI errors - tracking them closer

From: Fred Cohen <[email-masked]>
Date: Fri Sep 12 11:55:42 2003

The old version produced a call-rawsock.c file with this:

extern uint8 (buffer)[1518];
extern struct t1261 { sint16 SA_FAMILY; sint8 (SA_DATA)[14]; } from;
extern uint8 (f)[16];
extern uint8 (timestamp)[16];
extern char* ts;
extern int (rawsocket)();
extern int (closesock)();
extern uint16 (ipcsum)();
extern uint16 (icmpcsum)();
extern uint16 (tcpcsum)();
extern uint16 (udpcsum)();
extern int (recvfr)();
extern int (sendt)();
extern int (gettime)();
extern int (backup)();
extern int (restore)();
extern int (configdev)();
extern void (perror)();

The new version misses this part - leading to a signficant failure in
the compilation.  So I added this into the file and tried from there... 
and I get errors again after that - which I will trace futher - however,
I seem to have a hard time believing that others are having these sorts
of problems.  Perhaps I did something wrong in install or making the new
clisp.  Has anyone else experienced these issues? Any suggestions on how
to cure it?

FC
-- This communication is confidential to the parties it is intended to serve --
Fred Cohen - http://all.net/ - [email-masked] - [email-masked] - tel/fax: 925-454-0171
Fred Cohen & Associates	- University of New Haven - Security Posture

---

From: Sam Steingold <[email-masked]>
Date: Fri Sep 12 12:29:36 2003

>* Fred Cohen <[email-masked]> [2003-09-11 22:02:56 -0700]:
>

NEWS:

* FFI does not output extern variable and function declarations unless
  you set FFI:*OUTPUT-C-VARIABLES* and/or FFI:*OUTPUT-C-FUNCTIONS* to T.
  Please use FFI:C-LINES to include the appropriate headers instead.
  See <http://clisp.cons.org/impnotes.html#ffi-extern-output> for details.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Why do we want intelligent terminals when there are so many stupid users?

---

From: Fred Cohen <[email-masked]>
Date: Fri Sep 12 21:08:03 2003

> > The old version produced a call-rawsock.c file with this:
...

>   See <http://clisp.cons.org/impnotes.html#ffi-extern-output> for details.

OK - this is changed from the last version.  So I did this and... it
still doesn't create the declarations required - as before:

(DEFPACKAGE "RAWSOCK" (:use "LISP" "FFI"))
(IN-PACKAGE "RAWSOCK")

(setf FFI:*OUTPUT-C-FUNCTIONS* t)
(setf FFI:*OUTPUT-C-VARIABLES* t)

; (setq snaplen 1514)
(def-c-var buffer (:name "buffer"...

Yields no declarations when I do:

LD_RUN_PATH=/usr/local/lib
LD_LIBRARY_PATH=/usr/local/lib
base=/usr/local/lib/clisp/base;export base
rm -rf ${base}/rawsock
export CLISP_LINKKIT=/usr/local/lib/clisp/linkkit/
rm -rf call-rawsock.c call-rawsock.fas call-rawsock.lib rawsock
/usr/local/lib/clisp/clisp-link create-module-set rawsock call-rawsock.c
cc -O -c rawsock.c
cd rawsock
ln -s ../rawsock.o rawsock.o
cp -f ../thingtofix link.sh
cd ..
${base}/lisp.run -M ${base}/lispinit.mem -q -c call-rawsock.lisp

It still yields a C program without the declarations, resulting in:

/usr/local/lib/clisp/clisp-link add-module-set rawsock ${base} ${base}/rawsock ->

call-rawsock.c: In function `module__call_rawsock__init_function_2':
call-rawsock.c:19: `buffer' undeclared (first use in this function)
call-rawsock.c:19: (Each undeclared identifier is reported only once
...

What ELSE has changed? Is there some example of a working program in the
FFI interface and all of the compilation process that works so I can use
it to make mine work? The ones on the web site - carried out step by step
- fail. 

FC

---

From: Sam Steingold <[email-masked]>
Date: Fri Sep 12 21:14:05 2003

>* Fred Cohen <[email-masked]> [2003-09-12 21:06:37 -0700]:
>

the prototypes are output at compile time, so you need

(eval-when (compile) (setq ffi:*output-c-functions* t))

I _really_ urge you to include headers instead.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
I haven't lost my mind -- it's backed up on tape somewhere.

---

From: lin8080 <[email-masked]>
Date: Sun Sep 14 12:34:02 2003

Hallo

Oh, I'm so sorry. But look at this and ask yourself:
Are you a Linux-Man doing some Lisp
or
are you a Lisp-Man doing some Linux?
(This is the main reason, i use lisp with windows.)

> (def-c-var buffer (:name "buffer"...

------------------------

> call-rawsock.c:19: (Each undeclared identifier is reported only once

Maybe you are right, this belogs not directly inside this list. But
think about, where did this trend end? So please, keep cl as mutch as
possible autonomy. 

stefan