This is a practice project to test Common Lisp + C with CFFI.
CFFI is a protocal for common lisp, and most popular impl like sbcl,ccl,cmucl,ecl and abcl have to this. So We can eazy to access C code from Common Lisp.
just only write for Linux(Unix) and need a lisp impl with cffi package. I pratice it with sbcl. You can install it with Roswell, or you can also ues more friendly env - cl-repl which also can install by roswell.
- OS: Linux(Unix)
- A Common lisp impl with cffi
- C compiler
- gcc
- Make (or compile c file to library by self)
- First compile C to a library(.so).
- rum Common Lisp REPL
- load lisp file
just type make
to gen libhello.so file
make
sbcl
use sbcl
, or ccl
, ecl
,ros run
,cl-repl
et.
(load "hello")
direct call c function
56
Hello, World
Hello, Bob
Hello, Andy
---------------------------
define c function, then call
56
Hello, World
Hello, Bob
---------------------------
change var a to 100,
then sccess a:100
call showA:100