|
From: | Felix Winkelmann |
Subject: | [Chicken-users] Re: Structs |
Date: | Tue, 15 Oct 2002 09:13:03 +0200 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530 |
Peter Keller wrote:
On Mon, Oct 14, 2002 at 08:57:05AM +0200, Felix Winkelmann wrote:In this case I would create a number of foreign-lambda*s that access the slots:So, I actually thought of this, but rejected it because I didn't understand how gc would affect it. I thought that I could end up with a way that I'd have a valid z_stream object with a member field pointing to gc'ed data.
There's no problem with GC, because the values stored/loaded in/from the fields always undergo the normal processing of arguments to foreign functions. It's only if you pass values of type `pointer' (not `c-pointer' or `(pointer ...)'), `scheme-object', byte-/number-vectors or locatives, when you have to be careful. I recommend to create your own byte-vectors (malloc'd) for storing the compressed data. Then you can use finalizers to handle cleaning-up. cheers, felix
[Prev in Thread] | Current Thread | [Next in Thread] |