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

Simon Ortiz o.simon at gmail.com
Sat Aug 18 05:09:48 UTC 2012

Sure! Please find attached two examples. The examples use the "sin"
function from libm.

What I'm trying to achieve is producing a static library that makes
use of foreign functions. The ECL I'm using is built without DFFI. I'm
using the latest version from git.

In each example you can LOAD the file `build.lisp' into ECL (please,
change the paths as necessary). It should create a static library for
the corresponding example. Then, you can use `make' to build an
executable that is linked against the static library.

The first example is ffi-test. It contains an example using the
low-level FFI of ECL. This example works nicely.

The other example is cffi-test. Lamentably, I haven't managed to make it work.

I would like to reproduce the functionality of ffi-test in cffi-test.
That is, I would like to produce a static library that uses CFFI to
access foreign functions.

I'm sure I'm missing something in cffi-test. I've tried different ways
of compiling, but with no success.

Thank you very much!

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

On 17 August 2012 20:13, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at gmail.com> wrote:
> On Thu, Aug 9, 2012 at 1:31 PM, Simon Ortiz <o.simon at gmail.com> wrote:
>> 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.
> ECL has two ways to use a foreign library: one is to link with it, the other
> one is to load it dynamically. Could you produce a tiny example of what you
> are trying to achieve so that I can test it or improve it?
> Juanjo
> --
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffi-test.tgz
Type: application/x-gzip
Size: 1121 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20120818/af04e50c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cffi-test.tgz
Type: application/x-gzip
Size: 1532 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20120818/af04e50c/attachment-0001.bin>

More information about the ecl-devel mailing list