[plt-scheme] Binding C-Structs Containing Fixed-Size Arrays with the FFI
On Jan 26, Henk Boom wrote:
> 2009/1/26 Jakub Piotr C?apa <jpc-ml at zenburn.net>:
> > You may want to check these threads:
> >
> > http://thread.gmane.org/gmane.lisp.scheme.plt/12987
> > http://thread.gmane.org/gmane.lisp.scheme.plt/28412/focus=28509
> > http://list.cs.brown.edu/pipermail/plt-scheme/2007-March/016671.html
>
> Thank you. I've taken a look, and come up with a solution, but I'm
> not sure if it's correct.
It looks fine, and better than the previous solution, I think.
> Specifically, I don't know how the garbage collector will interact
> with it: will the the cvector created by make-cvector* properly
> "own" the buffer it references?
At the scheme side -- as long as you're doing the allocations -- there
shouldn't be any problems since it's all handeled transparently by the
GC. But in general, one good property of a moving GC is that memory
bugs pop up fast: just run `collect-garbage' in random places and see
if it doesn't crash.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!