[Gsll-devel] clisp&cffi: broken foreign functions in saved images
Sam Steingold
sds at gnu.org
Thu Aug 20 16:01:42 UTC 2009
Hi,
I do this:
$ clisp -x '(asdf:operate 'asdf:load-op :gsll)
(saveinitmem "gsll" :executable t)'
$ ./gsll
>
> (gsll:make-chebyshev 1)
FFI::FOREIGN-CALL-OUT: no dynamic object named "gsl_cheb_alloc" in library
:DEFAULT
this indicates a bug somewhere between cffi and gsll.
specifically, the definition of the foreign function gsl_cheb_alloc should
specify that it is to be found in "libgsl.so", not in :default.
moreover, when I do the (not so) trivial thing:
(ffi:default-foreign-language :stdc)
(ffi:open-foreign-library "libgslcblas.so")
(ffi:def-call-out gsl_cheb_alloc (:library "libgsl.so")
(:arguments (n ffi:int)) (:return-type ffi:c-pointer))
(gsl_cheb_alloc 10)
;; ==> #<FOREIGN-ADDRESS #x0000000005503380>
(saveinitmem "foo" :executable t)
(quit)
./foo
(ffi:open-foreign-library "libgslcblas.so")
(gsl_cheb_alloc 10)
#<FOREIGN-ADDRESS #x0000000001D9F4C0>
i.e., if the foreign function definition includes the correct library name,
the function will work automatically[*] even in the saved image.
So, since I am not quite sure where the bug is hiding,
I am reporting this to both gsll and cffi lists.
Thanks.
Sam.
[*] apparently, libgsl.so cannot be loaded before libgslcblas.so is.
how do people specify such dependencies?!
More information about the gsll-devel
mailing list