[cffi-devel] (no subject)

Luke J Crook luke at balooga.com
Wed Dec 23 01:11:09 UTC 2009


Luís Oliveira <luismbo <at> gmail.com> writes:

> 
> On Tue, Dec 22, 2009 at 3:27 PM, Stelian Ionescu <sionescu <at> cddr.org> 
wrote:
> > (cffi:define-foreign-library sdl-glue
> >  (:windows "lispbuilder-sdl-glue.dll"))
> >
> > (use-foreign-library sdl-glue)
> >
> > On Linux, this returns fine, although it doesn't load any library.
> > I see code in lispbuilder-sdl that relies on it signaling an error.
> > Is it a regression ?
> 
> No, this was the intended behaviour. I can see why making it work more
> like ECASE instead of CASE might be desirable, though I'm not sure
> it's worth breaking backwards compatibility. I'm all ears to
> compelling arguments, though. 
> 

lispbuilder-sdl and lispbuilder-sdl-ttf conditionally load different CFFI forms 
depending on the availability of a particular library.

For example, if the lispbuilder-sdl-ttf-glue.dll is available then the 
corresponding CFFI glue forms are conditionally loaded. If this library is 
unavailable, then different CFFI code will fake out passing the SDL_Color 
struct by value by passing a packed integer instead.

Similarly, if lispbuilder-sdl-glue.dll is available, then basic sound loading 
and mixing support is enabled directly from lispbuilder-sdl. If the library is 
not available, then this basic sound support is enabled only for Lispworks 
because Lispworks can handle 'unknown' threads.

Is there a mechanism in CFFI to enable this if define-foreign-library cannot be 
used?

- Luke





More information about the cffi-devel mailing list