chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] C unions and structs, how to access them ?


From: felix winkelmann
Subject: Re: [Chicken-users] C unions and structs, how to access them ?
Date: Tue, 1 Nov 2005 06:53:52 +0100

On 10/31/05, Pupeno <address@hidden> wrote:
>
> Does define-foreign-record work for unions as well ?
>

Yes, this should work. Record accessors expand into simple
component access ("return(abc->xyz);" / "abc->xyz=VAL;").

> Now, having tried a couple of approaches to this (as Schemish as possible), I
> am thinking of tring a different one.
> What about making my own C function, let's call it ChXNextEvent that call
> XNextEvent and extracts the info from the XEvent and initializes a Scheme
> native structure or record ? Is that possible ? Is it a good way ? Any
> hints ?

That way you have full control of allocation and make the result
GC-able. You probably want to use `foreign-primitive' for that.
It's a perfectly viable alternative.

Another approach might be SWIG (www.swig.org). The current
cvs version has even better Chicken support, thanks to John Lenz.


cheers,
felix




reply via email to

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