[cffi-devel] Semantics of defctype*

Rayiner Hashem rayiner at gmail.com
Sat Sep 1 04:42:15 UTC 2007


Hi. I was trying to get Verrazano up and running on my machine, and I
noticed that generated bindings would not happily C-c C-k for me in
Emacs. I reduced it to the following test case:

--- some-file.lisp ---

(in-package :cl-user)

(defpackage :test-package (:use :cffi :common-lisp))

(in-package :test-package)

(cffi::defctype sqlite-int64 :long-long)
(cffi::defctype* sqlite-int99 :long-long)
(cffi:defcfun ("foo" foo) :int (arg1 sqlite-int64))
(cffi:defcfun ("bar" bar) :int (arg1 sqlite-int99))

--- end some-file.lisp ---

If you're in a SLIME session with CFFI already loaded, compiling this
file once will result in an error. Compiling it again will make it
work.

If you compile just the cffi:defctype* declaration with C-c C-c, then
try compiling the file, it works.

Presumably, defcfun wants the types in its arg lists to be available
at compile time, and defctype* doesn't make them available?

That said, we shouldn't really be using defctype* at all, right?
Slightly more clever processing of definitions should obviate any need
for it.

Sincerely,
    Rayiner Hashem



More information about the cffi-devel mailing list