Subject: Re: ffi in acl problems
From: Erik Naggum <erik@naggum.no>
Date: 1999/08/10
Newsgroups: comp.lang.lisp
Message-ID: <3143268274698278@naggum.no>

* kjh63@cantua.canterbury.ac.nz (Kurt J Hausler)
| Hello.  I have a dll that has functions that I am trying to load into
| lisp but the function (def-foreign-call ) doesnt seem to work:
| 
| (def-foreign-call CreateDatabase () :returning :foreign-address)
| CREATEDATABASE
| USER(59): (createdatabase)
| Error: Attempt to call #("createdatabase" 1669872020 0 2 1669872020) for which
|        the definition has not yet been (or is no longer) loaded.
|   [condition type: SIMPLE-ERROR]
| 
| Now the dll has been loaded with :ld peval.dll and if it hadnt the
| (def-foreign-call ) would have caused an error, so I'm not sure whats
| wrong here.  Its quite clear to me that the function has been half
| defined sort of.

  the error message is a dead give-away that it's calling the wrong
  function.  instead, try

(def-foreign-call (create-database "CreateDatabase") ()
  :returning :foreign-address)

  also note that you're much better off always specifying Lisp name as a
  symbol and foreign name as a string literal, since you really don't want
  to mix naming conventions between languages.  the case hypersensitivity
  of C and Unix in general is a bug that there is no need to perpetuate.

#:Erik
-- 
  (defun pringles (chips)
    (loop (pop chips)))