[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] C unions and structs, how to access them ?
From: |
Pupeno |
Subject: |
Re: [Chicken-users] C unions and structs, how to access them ? |
Date: |
Tue, 1 Nov 2005 02:24:29 -0300 |
User-agent: |
KMail/1.8.3 |
On Monday 31 October 2005 03:57, felix winkelmann wrote:
> On 10/30/05, Pupeno <address@hidden> 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 <address@hidden> (http://pupeno.com)
pgpTvy5OQDHfB.pgp
Description: PGP signature
- Re: [Chicken-users] C unions and structs, how to access them ?,
Pupeno <=