[Ecls-list] CFFI and DFFI

Matthew Mondor mm_lists at pulsar-zone.net
Mon Jul 20 15:24:25 UTC 2009


Hello,

I've been playing a bit with FFI on a non-threaded ECL 9.7.1 build on
NetBSD 5.

In CFFI tests, cffi:load-foreign-library generates the following error
at compile-time:

LOAD-FOREIGN-LIBRARY requires ECL's DFFI support. Use FFI:LOAD-FOREIGN-LIBRARY with a constant argument instead.

Indeed replacing it by ffi:load-foreign-library works, but this
basically means that every CFFI-based library I try to load fails to
work without local changes.  Interestingly, FFI:*USE-DFFI* returns T
so I'm a bit confused as to what is missing relating to DFFI.

Some UFFI tests seemed to work allright, including
CFFI:LOAD-FOREIGN-LIBRARY.

Another test was using an existing library built on CFFI.  iolib was
the first candidate but unfortunately failed to build with some "not a
proper list" error in an asdf file which appears fine (I might
eventually look further into this, it also works on SBCL).

So I then tried lispbuilder-sdl, which builds fine once the
CFFI:LOAD-FOREIGN-LIBRARY is replaced with an FFI:LOAD-FOREIGN-LIBRARY
call.  Some lispbuilder-sdl examples/tests then work fine, while most
others fail with the error:

4278190080 is not of type FIXNUM.
in SDL-CREATE-RGB-SURFACE

Which function is defined as follows:

(cffi:defcfun ("SDL_CreateRGBSurface" SDL-Create-RGB-Surface) :pointer
  (flags :unsigned-int)
  (width :int)
  (height :int)
  (depth :int)
  (Rmask :unsigned-int)
  (Gmask :unsigned-int)
  (Bmask :unsigned-int)
  (Amask :unsigned-int))

Unfortunately the backtrace didn't provide the arguments passed to the
function call.

The test that succeeds (sdl-example:bezier) appears to then leave ECL
looping in an endless RUN loop once the window is closed (not even
interruptible via slime, I have to send the process SIGTERM from the
shell.  All tests succeed on SBCL, also without the endless loop
issue.

Thanks,
-- 
Matt




More information about the ecl-devel mailing list