I'm trying to learn common lisp but am having a very difficult time setting up my environment.
I'm trying to wrap a c library using cffi
but I can't seem to get sbcl to find the cffi
package. I have previously installed it using (ql:quickload :cffi)
.
I'm using vlime.
I've tried the following:
(defpackage my-package
(:use :cl :cffi))
(in-package :my-package)
in which case I get the following error:
The name "CFFI" does not designate any package.
when I try to compile the file using \of
in vlime.
This error persists if I add (ql:quickload :cffi)
or (asdf:load-system :cffi)
before or after the previous code. In addition, it seems to put vlime into an unrecoverable state.
If I remove :cffi
from :use
then I get the error
Package CFFI does not exist.
The error persists when trying to use ql
as well.
I've also tried using (require :cffi)
and all permutations of combinations with the ql
and asdf
imports.
I'm very close to giving up on common lisp. What am I doing wrong?
EDIT:
I also have :depends-on (:cffi)
in my asd
file.
You need to ensure that CFFI is loaded at compile time. A single-file solution is
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :cffi))
...
(defpackage :foo
(:use :cl :cffi)
...)
If you are using ASDF (which is more scalable) then make your system depend on CFFI and compile and load the system in the first instance.