Re: passing C data to Scheme world Michael Sperber 27 Dec 2003 17:33 UTC

>>>>> "Shiro" == Shiro Kawai <xxxxxx@lava.net> writes:

Shiro> Regarding "Keeping C data structures in the Scheme heap".

Shiro> Do we limit it to have simple structures that have no
Shiro> pointers to outside resource?  Otherwise we have some
Shiro> issues:

Shiro> - If we want to keep C structures that has pointers,
Shiro>   in Scheme heap, we need a hook to tell GC about it.

The idea is that you either keep those pointers somewhere in the
Scheme world or register them via SCHEME_GC_PROTECT_GLOBAL and manage
them manually.

We punted on this whole issue because (as you noticed) it requires
bringing in a whole bunch of complex machinery.  (See, say, the
Objective Caml FFI for an idea just how complex.)  Moreover, in my
experience, keeping the references in Scheme usually makes a lot of
things easier.

Shiro> - Related to above; if we want to keep C structures that
Shiro>   has handles for extrenal resouces (externally allocated
Shiro>   memory, opened file descriptor, etc.), we need a kind of
Shiro>   finalization mechanism.

That's also something meant to be done in Scheme.

--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla