chicken-users
[Top][All Lists]
Advanced

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

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


From: Thomas Chust
Subject: Re: [Chicken-users] assigning scheme object to foreign pointer
Date: Mon, 16 Dec 2013 01:26:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 2013-12-16 00: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.
> [...]

Hello,

check out CHICKEN_new_gc_root and friends [1]. These functions can be
used to manage mutable cells that can hold references to Scheme objects
and are taken into account by the garbage collector.

Ciao,
Thomas


--
[1] http://wiki.call-cc.org/man/4/Embedding#chicken_new_gc_root


-- 
When C++ is your hammer, every problem looks like your thumb.




reply via email to

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