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

Robert Lehr bozzio at the-lehrs.com
Thu Oct 16 01:06:01 UTC 2003


On Thu, Oct 16, 2003 at 09:11:32AM +0200, Juan Jose Garcia-Ripoll wrote:
> 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!

Thanks.

> > 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.

Ah- good.  That sounds very good.  I was wondering about the absence
of the SO/DLL to link my program against.  I will wait until I am more
familiar with everything, though, since I am just now familiarizing
myself with the interface.  But I am definitely looking forward to
seeing it.

> > 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.

That explains the 172 'illegal frs index' messages.  I don't see the
workarounds, though.  How do I catch the error?

> > 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.

That explains the failed make_lambda() call.  Do you mean, though,
that I can use si_make_lambda(), that it is safe?  Is this the
workaround that you mentioned above?

> > 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.

I understand, especially with documentation.  I don't mind working
through them.  Would you mind me sending discrepancies or corrections
when I find them?

The info is appreciated.  I can now continue working in peace that, at
least, I got this part working.

BTW, I wrote an RPM spec file to install ECL on my system.  Do you
want it?  Even if it is not useful for you, it might be for others
wanting to install ECL or for distributing binaries.

Muchas gracias, Juan.

-- 

Robert Lehr




More information about the ecl-devel mailing list