Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question about CAMLparamx macros
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Question about CAMLparamx macros
On Thu, Apr 10, 2008 at 11:20:53AM -0500, Raj Bandyopadhyay wrote:
> I am programming using the OCaml-C interface, and occasionally, my 
> program segfaults in the OCaml function 'caml_oldify_local_roots()'
> 
> From previous experience, I know that this usually means that I'm not 
> using the CAMLparam/CAMLreturn macros correctly somewhere, causing the 
> OCaml gc to find NULL pointers.
> 
> My question is, when do I have to use or not use these macros? I know I 
> need to use these when my C function accepts AND returns OCaml 'value' 
> types, but what about the following cases?

It's very instructive to actually look at how these macros are defined
(ie. what code they expand to).  There's nothing particularly magical
or complicated about them.

Rich.

-- 
Richard Jones
Red Hat