Version française
Home     About     Download     Resources     Contact us    
Browse thread
C binding and GC interaction: storing values outside the heap
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stéphane Glondu <steph@g...>
Subject: Re: [Caml-list] C binding and GC interaction: storing values outside the heap
Le 07/09/2010 22:58, Paolo Donadeo a écrit :
> I'm writing a Lua API binding
> [...]
> typedef struct ocaml_data
> {
>  value state_value;
>  value panic_callback;
> } ocaml_data;
> [...]
>    /* alloc space for the register entry */
>    ocaml_data *data = (ocaml_data*)caml_stat_alloc(sizeof(ocaml_data));
>    caml_register_global_root(&(data->panic_callback));
>    data->panic_callback = *default_panic_v;

Why don't you call caml_register_global_root on &(data->state_value) as
well?

-- 
Stéphane