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

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Wed Feb 1 18:05:45 UTC 2006


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.



More information about the cffi-devel mailing list