Greetings!
I'm not really sure if this is a CFFI or a CLISP issue, so I'm posting to both ml's.
I'm trying to make Windows executables images, using Clisp 2.41
(built with readline, iconv and sigsegv). My images have cl projects
loaded, like clsql or celltk. These projects relly on cffi to load
functions from certain dll's (like odbc32.dll). E.g., I load clsql and
save an image.
There are two problems here:
1) Unlike AllegroCL or Lispworks, Clisp (and SBCL too, btw) requires me to precede all defcfuns related to a library with:
#+clisp (cffi::use-foreign-library Tcl)
(defcfun ("Tcl_FindExecutable" tcl-find-executable) :void
(argv0 :string))
If I don't do this, I can't apply this function at run-time (I'm not even talking about saved images, yet).
2) When I load the saved image (using the code from above), I get
an error when applying defcfun'ed functions, telling me the library
wasn't found:
** - Continuable Error
FFI::FOREIGN-CALL-OUT: no dynamic object named "SQLAllocHandle" in
library
:DEFAULT
But then, if I tell clisp where the libraries are, with
(cffi:define-foreign-library odbc (t (:default "odbc32")))
(cffi:use-foreign-library odbc)
, I get this:
*** - FFI::FOREIGN-CALL-OUT: #<INVALID FOREIGN-POINTER #x00000000>
comes from
a previous Lisp session and is invalid
The
only workaround I can think of is to make an init-function on my image
that loads all these defcfuns (at run-time), but this is not very sane,
if you are to use many external CL libraries!
Thanks for the help,
--
Edgar Gonçalves