Hello,
I'm having some difficulty passing arguments to defcfun. This is likely due to my incomplete knowledge of lisp, so hopefully someone can point me in the right direction. Given the following code:
defpackage :cffi-test (:use :common-lisp :cffi))
(in-package :cffi-test)
(defun strip-args (args) (let ((new-args nil)) (dolist (elm (car args)) (setf new-args (append new-args (list (subseq elm 0 2))))) new-args))
(defun make-defcfun-call (c-name lisp-name returns &rest args) `(defcfun (,c-name ,lisp-name) ,returns ,@(strip-args args)))
(defmacro pl-defcfun (name returns &rest args) (make-defcfun-call (elt name 0) (elt name 1) returns args))
(defmacro pl-defcfun-2 (name returns &rest args) (make-defcfun-call (elt name 0) (make-symbol (format nil "bar- ~A" (elt name 1))) returns args))
This creates a function called l-foo:
(pl-defcfun ("c-foo" l-foo) :void (x :char) (y :char))
This should create a function call bar-l-foo (or maybe #|bar-l- foo|?), but doesn't appear to (as judged by my not getting a function prototype at the slime REPL).
(pl-defcfun-2 ("c-foo" l-foo) :void (x :char) (y :char))
Maybe defcfun is not getting the right kind of symbol? I am running SBCL 0.9.9 with a few week old version of slime from cvs on OS-X 10.4.
Thanks for your help, -Hazen