Marco Antoniotti <
mar...@gmail.com> writes:
> Hi
>
[snip]
>
> (cffi:define-foreign-library cl-autowrap-tests-lib
> (t "cl-autowrap-test.a"))
>
>
> This is what I get on LWM.
>
> CL-USER 15 > (cffi:load-foreign-library 'cl-autowrap-tests::cl-autowrap-tests-lib)
>
> Error: Unable to load foreign library (CL-AUTOWRAP-TESTS-LIB).
> Could not register handle for external module CL-AUTOWRAP-TESTS::CL-AUTOWRAP-TESTS-LIB:
> no suitable image found. Did find:
> /Users/marcoxa/Projects/Lang/CL/tests/cl-autowrap/cl-autowrap-test.a: file too short.
[snip]
> Any ideas?
Yes. You cannot load a .a (static) library with CFFI. CFFI goes through
the _dynamic_ loader (dlopen() syscall on linux and macOS). You need to
bring in the .a lib at link time to a C++ exe. Or, in other words, if
you are in Lisp only, the you can't load the .a lib.
Not what you wanted to hear/read, I can imagine, but ... If you really,
really need to have the static lib you might want to load Lisp as a
dynamic lib into a manually set-up C/C++ exe - you then can link the
static lib to the exe and use CFFI to define the foreign function
calls.... Yes, clumsy.
Frank