[Ecls-list] load-foreign-library

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Tue Oct 24 17:08:53 UTC 2006


2006/10/24, Rick Taube <taube at uiuc.edu>:
> then lib loading seems to be working IF my ffi is complied and loaded.
> however if my ffi is loaded from its .fas files without compiling
> then i still get an error:
>
> ;;; Loading "/Lisp/portmidi/cffi-portmidi.fas"
> Unknown CFFI type: PORTMIDI::PM-TIMESTAMP.
> Broken at CALL-NEXT-METHOD.
> CM>>

I have tried to reproduce what you mean. First I create a file test.lisp with

(cffi:define-foreign-type pm-message () ':long)
(cffi:define-foreign-type pm-timestamp () ':long)
(cffi:defcstruct pm-event
                (message pm-message)
                (timestamp pm-timestamp))

(ffi:clines "
int foo(void *p) {
  return p;
}")

(cffi:with-foreign-object (s 'pm-event)
 (print (cffi:foreign-funcall "foo" :pointer s :int)))

Next I load CFFI and compile this file with

> (load "cffi.fas")
> (compile-file "test.lisp" :load t)

As expected an integer is printed on screen.

Finally, I exit ECL and try to load the FAS by itself:

> (load "cffi.fas")
> (load "test.fas")

Again, an integer is printed on screen. So things seem to work. Can
you reproduce my steps?

Juanjo




More information about the ecl-devel mailing list