[Ecls-list] c-inline conflict in cl-user

Dave Roberts dave at vyatta.com
Thu Jul 6 03:33:48 UTC 2006

On Wed, 2006-07-05 at 09:34 +0200, Goffioul Michael wrote:

> Are tou sure you didn't use C-INLINE symbol elsewhere before trying
> to use-package FFI?

Here's what I'm doing. Maybe it's pilot error. If so, please excuse and
educate me (I'm starting to wonder if I don't need EVAL-WHEN here?). I'm
trying to compile and load this simple FFI example. Just 3 forms, that's

(use-package "FFI")

"#include <sys/time.h>")

(defun gettimeofday ()
  (c-inline () () (values :int :int :int :int :int)
"struct timeval tv;
 struct timezone tz;
 int ret = gettimeofday(&tv, &tz);
 @(return 0)=ret;
 @(return 1)=tv.tv_sec;
 @(return 2)=tv.tv_usec;
 @(return 3)=tz.tz_minuteswest;
 @(return 4)=tz.tz_dsttime;" :one-liner nil))

When with this file, which I named eclffi.lisp, do the following:
1. Start ecl
2. Compile the file with (compile-file "eclffi.lisp")
3. Load the file with (load-file "eclffi")
4. Note the error.

Transcript below. It's almost as if the act of loading the file delays
the (USE-PACKAGE "FFI") form until after the (DEFUN GETTIMEOFDAY...)
form has already been read and the C-INLINE symbol is already interned
in CL-USER by the time the (USE-PACKAGE "FFI") executes.

[dave at linux ~]$ ecl/bin/ecl
ECL (Embeddable Common-Lisp) 0.9i
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  Broken at EVAL.
> (compile-file "eclffi.lisp")
;;; Loading #P"/home/dave/ecl/lib/ecl/cmp.fas"
;;; Loading #P"/home/dave/ecl/lib/ecl/sysfun.lsp"
;;; Compiling eclffi.lisp.
;;; Compiling (DEFUN GETTIMEOFDAY ...).
;;; End of Pass 1.
;;; Note: Emiting FUNCALL for CLINES
;;; Emitting code for GETTIMEOFDAY.
;;; Note: Emitting linking call for C-INLINE
;;; Calling the C compiler...
;;; Note: Invoking external command:
;;; gcc  -g -O2 -fPIC  -fstrict-aliasing -Dlinux -O "-
I/home/dave/ecl/lib/ecl/" -w -c "/home/dave/eclffi.c" -o

;;; Note: Invoking external command:
;;; gcc -o "/home/dave/eclffi.fas" -L"/home/dave/ecl/lib/ecl/"
"/home/dave/eclffi.o"  -Wl,--rpath,/home/dave/ecl/lib/ecl/ -shared    -
lecl -ldl  -lm   -lgmp

;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3
;;; Finished compiling eclffi.lisp.
> (load "eclffi")
;;; Loading #P"/home/dave/eclffi.fas"
Cannot use #<"FFI" package>
from #<"COMMON-LISP-USER" package>,
because FFI:C-INLINE and C-INLINE will cause
a name conflict.
Broken at LOAD.

More information about the ecl-devel mailing list