> Hi list,
>
> If I wish to pass multiple data pointers in a struct as the return value
> of a C function, are the pointers still handled by the GC as they are
> when returned individually? If not, how do I flag these for persistence
> (being while the the app is running)?
>
> For example, I have a struct like this
>
> typedef struct somedata
> {
> sometype *st;
> sometype *st2;
> } somedata_t;
>
> I'd like the items contained to both be persisted while the app is running.
I guess you want to store a somedata_t* into the "data" part of an
abstract value ?
- if your pointer is allocated by C, it's fine as long as you don't
store any "value" inside it
- if your pointer is allocated by NekoGC, it's fine and you can store
values inside it
- if your pointer is allocated by C but you want to store values inside
it, you'll have to store alloc_root() pointers instead and store the
values in this root.
It cases 1 and 3, it's also a good thing to setup a val_gc for your
abstract so everything (both C blocks and Neko roots) get freed when the
neko abstract is no longer reachable.
Nicolas
--
Neko : One VM to run them all
(http://nekovm.org)