On Monday 31 October 2005 03:57, felix winkelmann wrote:
> On 10/30/05, Pupeno <[EMAIL PROTECTED]> wrote:
> > So, when I try to wrap XNextEvent I end up with two procedures:
> >
> > (define x-next-event-raw
> >    (foreign-lambda void "XNextEvent" display x-event))
> >
> > (define (x-next-event d)
> >    (let ((e (foreign-value "malloc(sizeof(XEvent))" c-pointer)))
> >       (x-next-event-raw d e)
> >       e))
> >
> > Is that the right way to do it ? If not, how should I do it ?
>
> This is fine, just make sure to free the malloced structure again.

Right. But when ? Can the Garbage Collector take care of it ? I mean, is there 
a way to make the Garbage Collector take care of e ?
Or is there another way to create an XEvent in which the garbage collector 
will take care of it ? I now have (define-foreign-record XEvent ...) but it 
seems it didn't made a make-XEvent.

Thank you.

-- 
Pupeno <[EMAIL PROTECTED]> (http://pupeno.com)

Attachment: pgpEMX8ftBFBq.pgp
Description: PGP signature

_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to