[Ecls-list] calling ECL functions defined in an ASDF package from C code

Eric Schulte schulte.eric at gmail.com
Sat Jun 25 18:48:37 UTC 2011

Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com> writes:

> On Sat, Jun 25, 2011 at 5:07 AM, Eric Schulte <schulte.eric at gmail.com>wrote:
>> I have successfully
>> compiled the ASDF package defining the library into a libelf.a library
>> using the following command.
>>  (asdf:make-build :elf :type :lib :move-here "/home/eschulte/src/elf/")
>> While this seems to have been successful, and while I have been able to
>> manipulate generic ECL lisp objects from within C code, I can not figure
>> out how to access the lisp functions defined in this static library from
>> a file of C code.
> You are still missing a crucial step: building your library into a program.
> This is the reason why MAKE-BUILD has another target, :type :program, which
> does the missing steps: linking C and Lisp code together.
>> My latest attempt is the following run.c file.
> File is missing all the steps that MAKE-BUILD takes to initialize the
> library. There is a reason why MAKE-BUILD and C:BUILDER exist: to hide this
> interface from you because it is very ugly and prone to change -- if you
> read my other email today, those changes are related to this interface
> (loading libraries and initializing their data).

I see, thanks for explaining.  The reason that I do not simply build a
program directly is that the my ultimate goal is to include this library
into a large existing system written in OCaml, so the final linking must
be done by Ocaml.

> I now realize C:BUILDER and C:MAKE-BUILD might need another target,
> something like :standalone-lib or :standalone-dll, where one would simply
> specify the name of the library and its initialization function and it would
> do the rest. I will note it down.

Thank you, such an interface sounds ideal.  Do you have any idea of a
time scale for such an implementation, e.g., on the order of days weeks
or months?

Best -- Eric

> Juanjo

Eric Schulte

More information about the ecl-devel mailing list