[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C interface standardization?



In article <9503061432.AA04085@cambridge.apple.com>,
David A. Moon <moon@cambridge.apple.com> wrote:
>> From: Andrew Wason <aw@bae.bellcore.com>
>> Date: Thu, 02 Mar 95 10:26:58 -0500
>> 
>> Also, once you provide an FFI to C, you need to worry about
>> memory management.  You need hooks into the garbage collector so
>> that when a Dylan object is collected, you can free any C objects
>> it contains (if appropriate).  But this GC interface also isn't
>> standardized so each Dylan will probably provide a different
>> interface.
>
>This is a good point, and since it is not dependent on the surrounding
>environment, it should be less difficult to standardize.  However it
>is still dependent on the goals and implementation strategies of each
>Dylan implementation.  I have been assuming that it was unrealistic to
>try to standardize on a uniform termination (sometimes called finalization)
>facility.  So I haven't done any more than communicate what Apple is doing
>for this to the Dylan Partners.

At Apple ATG (West) we've been using an experimental ehnancement
to MCL that lets you proxy a C struct with a lisp object which
references a finalizer function.  The finalizer is called after the
lisp object is reaped, and, of course, is used to dispose of the
struct and all that it entails.  It works extremely well.  With
this feature, you can "pave over" the ugliness of the netherworld
with a safe, clean lisp interface layer.  Watch for it in MCL 3.0.

Frankly, I don't know how anybody manages without this facility.
I hope these capabilities can become standardized in all safe
languages which provide an interface to the netherworld.

Dave Yost
Apple ATG
(from home)