[Top][All Lists]

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

Re: [Chicken-users] assigning scheme object to foreign pointer

From: pluijzer
Subject: Re: [Chicken-users] assigning scheme object to foreign pointer
Date: Mon, 16 Dec 2013 02:12:28 +0100

Hello Evan and Thomas,

Thank you for your suggestions, I decided to go for `CHICKEN_new_gc_root` and 
it works like I hoped.

I was the lookup-table before but found it to be too unwieldy in my project.

Thanks again,

On Mon, 16 Dec 2013 13:28:27 +1300
Evan Hanson <address@hidden> wrote:

> Hi Pluijzer,
> On 16/12/13 12:59, pluijzer wrote:
> > I am using a C-library that lets you assign user data to objects via a
> > void pointer. I would like to assign a scheme object to this pointer,
> > but as I understand I cannot use 'object->pointer' for this, as the
> > garbage collector might move the object.
> There are a couple of ways to do this.
> One is to manually move the object into static memory, via
> `object-evict` (
> This is nice and easy, but might not work as expected for all data
> types.
> Another is to create a new GC root for the object, via
> `CHICKEN_new_gc_root` and its associated procedures
> (
> You might also sidestep the issue entirely by keeping your objects in a
> Scheme-side lookup table and only storing immediate values in the
> pointer that you can then use to retrieve the objects as needed.
> Other folks may chime in with more ideas, but I hope these help some.
> Cheers,
> Evan
> _______________________________________________
> Chicken-users mailing list
> address@hidden

pluijzer <address@hidden>

reply via email to

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