Browse thread
Question about CAMLparamx macros
-
Raj Bandyopadhyay
- Mathias Kende
- Richard Jones
- Damien Doligez
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Mathias Kende <mathias@k...> |
| Subject: | Re: [Caml-list] Question about CAMLparamx macros |
Raj Bandyopadhyay a écrit :
> Do I have to use the CAMLparamx/CAMLlocalx/CAMLreturnx macros in the
> above cases? Would it cause problems if I used them anyway?
You should at least use these macros when the GC may be triggered during your C
function (e.g. with calls to some of the alloc_ functions) and you have local
"value", even if your function does not accept value as argument and/or does not
return a "value" variable.
> value foo(int x){
> return caml_callback();
> }
>
> should be replaced by
>
> value foo(int x){
> CAMLparam0();
> CAMLreturn(caml_callback());
> }
I believe that the first is correct, but I am not a real guru of this Ocaml-C
binding, so I am not sure of this.
Mathias