On 26/set/2005, at 05:51, Surendra Singhi wrote:
When I load the file through slime I get the error FFI::FOREIGN-LIBRARY-FUNCTION: no dynamic object named "sqrtf" in library :DEFAULT
but loading on the command line works fine.
That's probably because SLIME tried to compile the file. And at load-time, for compiled code, CLISP will try to lookup the foreign function (and it understandably fails, see below).
(By the way Kenny, if we remove that LOAD-TIME-VALUE in cffi-clisp.lisp's %FOREIGN-FUNCALL, CLISP will probably work dynamically like you like. Need to see how slower that would be before making such a change though. Although I'm still not convinced this much necessary.)
But if from the command line I execute,
I suppose here you just used the interpreter, this way CLISP will only lookup the foreign functions when trying to execute.
[3]> (cffi-examples:sqrtf 5)
*** - FFI::FOREIGN-LIBRARY-FUNCTION: no dynamic object named "sqrtf" in library :DEFAULT
*** - FFI::FOREIGN-LIBRARY-FUNCTION: no dynamic object named "gettimeofday" in library :DEFAULT
But the real problem is that sqrtf and gettimeofday are UNIX only, they don't exist in Windows. Well at least not in the C library your CLISP is using.
Thanks for your interest in CFFI!