[Ecls-list] UPDATE: Embedding ECL - how?

Dr. Edmund Weitz edi at agharta.de
Tue Jan 22 01:56:03 UTC 2002

I've made a little progress. I wrote a little Lisp file "fac.lisp" for
testing purposes...

  (defun fac (n)
    (if (= n 0)
        (* n (fac (1- n)))))
  (defun prfac ()
    (print (fac 100))
...and did...

  (compile-file "fac.lisp" :system-p t)

My C program 'lib.c' now is...

  #include "/usr/local/lib/ecl/h/ecl.h"
  void funcall_string_no_args (char *string) {
    clLfuncall(1, clLintern(1, make_string_copy(string)));
...and I've built my Image with...

  (c::build-program "myimage" :lisp-files '("fac.o") :ld-flags '("-L. -lmylib") :epilogue-code "funcall_string_no_args(\"PRFAC\");")

This time it actually works as I hoped it should:

  edi at bird:~> ./myimage 

edi at bird:~>

Fine! Now the questions remains: Is there an easier way call my own
functions? I understand that something like 'clLprfac' will probably
not be possible but is there a reliable way to find out that, say,
PRFAC is mapped to L2? And what will happen with these mappings if I
have more than one Lisp file?

Thanks again,

PS: I guess I can answer my question about the :SYSTEM-P parameter
myself now. Looks like it is needed to convice COMPILE-FILE to
generate an .O file instead of an .SO file.

More information about the ecl-devel mailing list