[plt-scheme] Questions about modules, compilation, namespaces, planet and ffi
On 4/29/05, Eli Barzilay <eli at barzilay.org> wrote:
> On Apr 29, Bruno Deferrari wrote:
> > This is what I made for the list, is it right?? (at least, it
> > seems to work)
> > ;====================================
> > ; Make a list, and free the array
> > (define-fun-syntax _list/free
> > (syntax-id-rules ()
> > [(_ t c) (type: _pointer
> > pre: (malloc c t)
> > post: (x => (begin0
> > (cblock->list x t c)
> > (free x))))]))
>
> I'm confused now -- you said that the foreign function is the one that
> allocates the vector, but in this code you do it, and you use the
> default malloc, so the GC will take care of it for you.
Mmmm... you are right, the foreign function is the one that allocates
memory, the pre: doesn't make much sense, I'm wondering why I put it
there on the first place.
Thanks again.