From: Henrick Yau
Subject: Question: Can a lisp function be called from C?
Date: 
Message-ID: <3nh5c9$gsj@delphi.cs.ucla.edu>
Hi,
I wonder if I can compile a lisp function, create a .o file, and link it 
within a C program under the Unix environment.  
If it's not possible, is there a way to call a lisp function from a C 
program?  I am using Lucid, but would like the code to be portable.

Any help is appreciated.
-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~
Henrick Yau
  ·······@base.cs.ucla.edu
  (310)206-4561
~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Barry Margolin
Subject: Re: Question: Can a lisp function be called from C?
Date: 
Message-ID: <3nj3ta$c23@tools.near.net>
In article <··········@delphi.cs.ucla.edu> ·······@london.cs.ucla.edu (Henrick Yau) writes:
>I wonder if I can compile a lisp function, create a .o file, and link it 
>within a C program under the Unix environment.  
>If it's not possible, is there a way to call a lisp function from a C 
>program?  I am using Lucid, but would like the code to be portable.

With most Unix Lisp implementations, you cannot create .o files from Lisp
code.  Instead, they usually provide a way to load a .o file into the Lisp
environment.  You can then define a Lisp interface to the C functions, as
well as defining Lisp callbacks that the C function can use.  Look in your
manual for "foreign functions" (in the case of Lucid, this is described in
the Advanced User's Guide).

There are a few Lisp implementations that do provide mechanisms for
compiling Lisp to .o files; these are generally the ones that are based on
Lisp-to-C translation.  I believe IBUKI Common Lisp provides this
capability, as does WCL.
-- 
Barry Margolin
BBN Planet Corporation, Cambridge, MA
······@bbnplanet.com