[Ecls-list] using ECL with C programs, a test

Juan Jose Garcia-Ripoll worm at arrakis.es
Thu Oct 16 00:11:09 UTC 2003


On Thursday 16 October 2003 03:05, Robert Lehr wrote:
> First, since I am asking for help, I should say that I will appreciate
> any help in making this work.  Thanks.
>
> Also, I think that, aside from the difficulty of actually embedding it
> applications, I expect that ECL looks very promising for all of the
> features that it offers as an embeddable ANSI-compliant Common Lisp.  I am
> very much looking forward to making it work for me on my current project.

New users are always welcome!

> I want to use ECL inside a pre-existing C program, with its current main().
> That immediately implies, AFAIK, that 'c:build-program' cannot be used for
> my task.  I expect that I will be using the 'c:build-shared-library'
> function, though, after my work has advanced.

There is work being done on the c::build* stuff. In the next release, if you 
do not use lisp code, you will not even need to use c::build* because ECL 
comes as a self contained DLL. A preview of these facilities is in CVS, but I 
do not recommend you to go and fetch it unless you feel familiar and 
confident enough with the old interface.

> I have developed a test-case that uses the model that (I think) is
> described in the info pages where the C functions for the
> ECL-interface are in a separate file, test.[ch] here.
> When executed, I receive the following errors:
>
>     $ ./ecl-test 1 "(x y) (princ '(x y))" 5 6 2>&1 | more [...]
>     LAMBDA: Illegal lambda list X.
>     0 is an illegal frs index.

As embedded library, your ECL has no toplevel. Thus, when it signals an error, 
there is no one to catch it. See below for workarounds.

> I "correct" the "Illegal lambda list X" error by wrapping more more
> parens around the arg-list, although that should not be necessary.  It
> definitely differs from the example in the "Bytecodes" section.

There is a typo in this section. Furthermore, the make_lambda() routine is 
unsafe, as I pointed out up there and there is a safer si_make_lambda() 
alternative. The interface for eval() has also changed. Thanks for pointing 
it out.

> Why is this happening?  How can I fix it?  Is it a bug or an error in
> my code/comprehension?

It is a bug in the documentation. I am a bit ashamed that it happened, but it 
is already hard enough to find time to work on the code.

Juanjo




More information about the ecl-devel mailing list