From: Mr T C R Shea
Subject: Problems in calling back Lisp functions from C
Date: 
Message-ID: <~Z=}?=-@warwick.ac.uk>
Could anyone help me by telling me how to call back Common Lisp
procedures from a C program.


Once I was given a Franz Lisp system together with a C program which
is used to do some graphical interface works. The command used
to call back the Franz Lisp procedures from the C program is "ftolsp"
and the usage is straight forward, like this:

In C:

   ftolsp_(matom(<Franz Lisp function name>));


But after I have re-written the system to Common Lisp syntax (under
Poplog environment), this command no longer works, and till now I
still cannot figure out a way to do this call back function.


(In fact, Poplog provides a command "pop_call" to facilitate the
calling back, but it can only call back procedures of another
language called Pop-11 rather than Common Lisp.)



Many thanks!


A beginner in Lisp and C,
Shea,
Dept. of Engineering,
Univeristy of Warwick, UK.
E-mail: ·····@uk.ac.warwick.eng   or
        ·······@uk.ac.warwick.cu
From: Charles A. Cox
Subject: Re: Problems in calling back Lisp functions from C
Date: 
Message-ID: <COX.91Jul19134655@crisp.Franz.COM>
In article <·······@warwick.ac.uk> ·······@warwick.ac.uk (Mr T C R Shea) writes:

> Once I was given a Franz Lisp system together with a C program which
> is used to do some graphical interface works. The command used
> to call back the Franz Lisp procedures from the C program is "ftolsp"
> and the usage is straight forward, like this:
> 
> In C:
> 
>    ftolsp_(matom(<Franz Lisp function name>));
> 
> 
> But after I have re-written the system to Common Lisp syntax (under
> Poplog environment), this command no longer works, and till now I
> still cannot figure out a way to do this call back function.

  The ftolsp trick is available in Franz Lisp only.  Allegro CL, Franz
Inc.'s Common Lisp, uses a different mechanism of declaring functions
to be called by C and uses the function lisp_call() to call such
functions.  If your Common Lisp code uses Allegro CL, you can read the
foreign functions section of the Allegro CL user's guide for more
information.

  At this time, there is no standard specification for interfacing
Common Lisp to foreign functions such as C.  Therefore, even though
other Common Lisp vendors are likely to have ways to call lisp
functions from C, you'll have to check their documentation.

	Charley
--
---
Charles A. Cox, Franz Inc.        1995 University Avenue, Suite 275
Internet: ···@franz.com           Berkeley, CA  94704
uucp:     uunet!franz!cox         Phone: (415) 548-3600; FAX: (415) 548-8253
				  [Please Note: Effective 7 Oct 1991, our area
				                code changes from 415 to 510]