chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Chicken C interface


From: Felix
Subject: Re: [Chicken-users] Chicken C interface
Date: Wed, 05 Jun 2013 23:36:15 +0200 (CEST)

From: Dan Leslie <address@hidden>
Subject: Re: [Chicken-users] Chicken C interface
Date: Wed, 05 Jun 2013 08:47:45 -0700

> I do this a fair bit in the Allegro egg.
> 
> Here's an example:
> https://github.com/dleslie/allegro-egg/blob/985ca2ceef0f5b4028af3f97729f13cba2976fe5/color.scm
> 
> Basically, use C_alloc to allocate the memory required to host both
> the List structure and the data it is to contain, then use the C_list
> macro to patch it all together.

Note that this code is not correct: C_alloc allocates on the C stack and the
data will be invalid once the function returns (Sorry). If this works, then
it is just coincidental!


cheers,
felix



reply via email to

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