[Ecls-list] building a static library that depends on CFFI

Simon Ortiz o.simon at gmail.com
Thu Aug 9 11:31:45 UTC 2012


Dear JuanJo,

thank you for taking the time to fix this bug. I'm sorry it took me so
long to come back to this.

I tried it, and the static library compiles without problems. Thank you.

My goal is to make a static library that is linked against a C library.

Let's say there is function in a C library that I call from some Lisp
code. I would like to compile this Lisp code to a static library.

I used the low-level FFI of ECL, I included the header of the library
using CLINES, and I wrapped the C function in a Lisp function with
C-INLINE. This worked very well.

Now, I would like to achieve the same using CFFI instead of FFI. Using
CFFI I tried several approaches, but I wasn't successful. Basically, I
compiled the Lisp code into a static library, but the produced library
seems not to include the C library. I tried to load the library at
compile time with FFI:LOAD-FOREIGN-LIBRARY, but it doesn't seem to
have any effect.

I'm sure there's something I'm missing. Is it possible to achieve
this? If so, how can I go about it?

Thank you very much!

--
Simón Ortiz B., M.Sc., Ing. en Computación
Linux Registered User #388735


On 11 August 2011 05:43, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> On Mon, Jul 18, 2011 at 6:50 AM, Simon Ortiz <o.simon at gmail.com> wrote:
>>
>> I want to build a static library that uses CFFI. I want to make the
>> library monolithic. For testing I tried to build a static library that
>> invokes the C sin function, but I fail to produce the binary. I'm
>> doing this on a Mac, using ECL 11.1.1, with no :dffi in *features*:
>
>
> Dear Simon, thanks again for providing me with such a detailed test case. I
> have finally managed to find out the problem: one of the ASDF-ECL compoments
> (monolithic-lib-op) needed special build rules, as it is the only one that
> can not be constructed out of statically linked libraries.
>
> I have uploaded a potential fix. Could you try it?
>
> Warning: Will be off-line for some days. Please excuse if I do not answer
> quickly.
>
> Juanjo
>
> --
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> http://juanjose.garciaripoll.googlepages.com




More information about the ecl-devel mailing list