* Returning caml values from C
@ 2007-08-21 22:51 andrew.p.cone
2007-08-22 7:24 ` [Caml-list] " Olivier Andrieu
0 siblings, 1 reply; 2+ messages in thread
From: andrew.p.cone @ 2007-08-21 22:51 UTC (permalink / raw)
To: caml-list
Hi everybody.
I have a C function that, given a list of caml values, returns a certain
sublist of those values.
Currently, I have the C code build up a caml list using caml_alloc and
Store_field. But when I try to access those values in caml, I get a
segfault.
I suspect the GC is deleting the input list, because it doesn't realize I've
made something new that refers to some of those values. How do I tell the GC
that something refers to some value?
Thanks,
AC
--
View this message in context: http://www.nabble.com/Returning-caml-values-from-C-tf4308363.html#a12264892
Sent from the Caml Discuss2 mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Returning caml values from C
2007-08-21 22:51 Returning caml values from C andrew.p.cone
@ 2007-08-22 7:24 ` Olivier Andrieu
0 siblings, 0 replies; 2+ messages in thread
From: Olivier Andrieu @ 2007-08-22 7:24 UTC (permalink / raw)
To: andrew.p.cone; +Cc: caml-list
On 8/22/07, andrew.p.cone <andrew.p.cone@gmail.com> wrote:
>
> Hi everybody.
>
> I have a C function that, given a list of caml values, returns a certain
> sublist of those values.
>
> Currently, I have the C code build up a caml list using caml_alloc and
> Store_field. But when I try to access those values in caml, I get a
> segfault.
>
> I suspect the GC is deleting the input list, because it doesn't realize I've
> made something new that refers to some of those values. How do I tell the GC
> that something refers to some value?
by registering the value with the macros CAMLparam* and CAMLlocal*
cf. http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#htoc229
--
Olivier
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-22 7:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 22:51 Returning caml values from C andrew.p.cone
2007-08-22 7:24 ` [Caml-list] " Olivier Andrieu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox