[cffi-devel] Problem with SDL_Init using CFFI with Clisp in W indows 98

Roger Sen Montero rogersm at rogersm.net
Wed Feb 1 22:04:21 UTC 2006


Joerg, Jeremy,

  at this time with the current cffi sdl file I created for a small 
project I'm adding manually the following line

  (load-foreign-library "libSDL.so")

  after the (in-package #:sdl)

  in your windows platform you should add your dll, not the so file.

  I suspect you should add the dll to your DLL PATH to allow cffi to 
find it. In unix I can write a fullpath to the library to make it work 
in any directory but I don't know if it will work in windows.

  Regards,
rogersm.

Hoehle, Joerg-Cyril wrote:
> Hi,
> 
> Jeremy Smith wrote:
>> CFFI-based SDL
>> module does not work on Windows 98 under Clisp. I just tested it on my
>> Windows 98 laptop (P166 :-) and it says the same thing. "FFI:
>> FOREIGN-LIBRARY-FUNCTION: No dynamic object named 'SDL_Init' in library
>> :DEFAULT"
> 
> I've a different opinion from James :)
> The one difference I see is that your CLISP code explicitly mentions the library to look after.  That is the most portable way and the way I recommend, even for UNIX.  It's precise, and you won't get hit by name clashes (e.g. Yaroslav Kavenchuk found duplicate sprintf across MS-Windows .dlls, one crashes, the other not...  Which one you get depends on the order in which the system opened libraries, AFAIK it's not even controlled by CLISP.)
> 
> CFFI does not provide such a mechanism.  There has been some recent work in that area, e.g. define-foreign-library and use-foreign-library. But it still seems (or my darcs copy is too old) that CFFI is not at the point where it can say for each function, or at the top of a file defining functions, "this/these belong/s to library XYZ".
> Please correct me if I'm wrong and this is antinews.
> 
> W.r.t. CLISP:
> o In MS-Windows >98, constantly using :library :default should work (clisp will scan all open libraries, you bet this takes time).
> o On Linux, CLISP was patched last year to make :library :default so that it would scan all libraries (to help people (e.g. CFFI users) *and* to work around bugs in other software, e.g. incomplete library dependencies).
> 
> o Doesn't Frank Buss got a patch to make MS-Windows-98 work (I lost track of it)?
> However, if MS-Windows-98 does not have means to inspect dlls for symbols (e.g. psapi.dll), then I don't see how this can be patched.  You can try to find a psapi.dll for MS-windows98??
> 
> You could only modify CFFI to emit a (:library *my-library*) into the code from defcfun and the above mentioned cffi:use-foreign-library to set that variable.
> 
> IMHO, the problem is with CFFI, not CLISP.  Lispworks would also benefit from using module names.  My bet/hope is that this is just a matter of time and volunteers to write code, and CFFI will behave nicely :-)
> Modules and the like have already been discussed in this list, here and there.  But we need people like you to complain to make discussions progress to real code!
> 
> Regards,
> 	Jorg Hohle.
> _______________________________________________
> cffi-devel mailing list
> cffi-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel



More information about the cffi-devel mailing list