chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Foreign type behaviour on callback entry


From: felix winkelmann
Subject: Re: [Chicken-users] Foreign type behaviour on callback entry
Date: Thu, 1 Dec 2005 10:41:45 +0100

On 11/29/05, Thomas Chust <address@hidden> wrote:
> Hello,
>
> a small question occurred to me which I could not solve using the
> CHICKEN manual: If I declare a callback function using define-external
> and give a parameter a type of c-string* will the string passed in
>  from C be deallocated after being copied into garbage collected
> memory?
>

This is correct.


(define-external (foo (c-string* x)) void
  (print "foo"))

(set! foo
  (##core#foreign-callback-wrapper
    'foo
    '""
    'void
    '(c-string*)
    (lambda (x3)
      (let ((x4 (##sys#peek-and-free-c-string x3 '0)))   ; <---
        (let () (print '"foo"))))))


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]