[Ecls-list] load-foreign-library

Rick Taube taube at uiuc.edu
Sat Oct 21 17:16:12 UTC 2006


> might not work and it is time for me to ask whether your platform
> allows for a dynamic FFI and whether it has been compiled in (Symbol
> :DFFI should be in *FEATURES*). I\

thanks for the explanation. im on osx/pcc so dffi is not supported  
there:

 > *features*
(:DARWIN :IEEE-FLOATING-POINT :CLOS-STREAMS :CMU- 
FORMAT :BSD :DLOPEN :CLOS
:THREADS :BOEHM-GC :ANSI-CL :COMMON-LISP :ECL :COMMON :POWERPC :FFI)
 >

im confused becuase the code in cffi-ecl.lisp indicates that i  
should  be able to use ffi:load-foreign-library with a consant name  
instead:

   #-dffi (error "LOAD-FOREIGN-LIBRARY requires ECL's DFFI support.  
Use ~
                  FFI:LOAD-FOREIGN-LIBRARY with a constant argument  
instead.")


however, when I add this to my ffi file:

	#+ecl (FFI:LOAD-FOREIGN-LIBRARY "/usr/local/lib/libportmidi.dylib")
	#-ecl (cffi:load-foreign-library *libportmidi*)

if i both compile and load my ffi file it loads (but nothing works):

 > (compile-file "cffi-portmidi.lisp"
 > (load "cffi-portmidi.fas")
 > (pm:portmidi)
FIND-FOREIGN-SYMBOL: Could not load foreign symbol "_Pm_Initialize"  
from module :DEFAULT (Error: NIL)
Broken at PORTMIDI:PORTMIDI.


if i restart ecl and just load the .fas then the file  doesn load:

 > (load "cffi-portmidi.fas")
;;; Loading "/Lisp/portmidi/cffi-portmidi.fas"
Unknown CFFI type: PORTMIDI::PM-TIMESTAMP.
Broken at CALL-NEXT-METHOD.

so im not sure if should be able to write a cffi program on osx or not.
--rick





More information about the ecl-devel mailing list