[Ecls-list] using built .a files in C program
Juan Jose Garcia Ripoll
worm at arrakis.es
Mon Mar 31 23:52:13 UTC 2003
On Tuesday 01 April 2003 01:18, Michael Hannemann wrote:
> Following the steps in the developer's guide, it seems like I should be
> quite close. I've been able to copy the stand-alone executable to another
> system and watch it run. (2.5MB! Much smaller than ACL or
> Lispworks.) I've produced a .a file, and I've looked at the temporary .c
> and .h files. But it seems like there's crucial interface information
> missing; I suspect I could call the munged and re-defined C functions L1
> (L2, &c.), but is there an easier way?
Have you considered using cl_funcall(), cl_apply() and c_string_to_object()?
With s = c_string_to_object("FIB") you obtain the symbol for your function
(assuming that the library has been initialized before). With cl_funcall(2,
s, MAKE_FIXNUM(2)), you use your function.
The only problem is initialization. Lisp libraries have to be initialized in
an order which corresponds to the order in which the would be loaded if they
were *.lsp files. ECL takes care of this when building executable programs:
build-program produces the right sequence of C statements for that. If you do
not want to use ECL to link the files, then I am afraid you will have to
inspect the output of build-program and reproduce it yourself.
Sorry, I know the interface is quite ugly, but I am very busy fixing errors in
the lisp part :-)
Juanjo
More information about the ecl-devel
mailing list