From: Tim Bradshaw
Subject: Re: Foreign Functions (was Re: Why lisp failed in the marketplace)
Message-ID: <>
* Sin-Yaw Wang wrote:

> It is possible to define a Scheme->C interface, that a Scheme
> function can call a C function.  I am not sure it is possible to
> define a C-> Scheme interface at the same time.  The stumbling block is the
> continuation, a concept really does not exist in C.

> Imagine a C function calling a user-level Scheme funciton that calls
> call/cc.  Later, another Scheme function invokes that continuation.

elk has, or had, this.  You need a small amount of tweaking somewhere
-- specifically you need to know how to copy an image of the stack
somewhere and then take such an image & copy it back onto the
stack. This is mildly hairy, but there isn't very much of it.  As far
as I can see, the sparc version requires one asm statement (but
presumably there is stuff somewhere else to work out where the stack
starts and which direction it grows in &c.