[
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: | Guillaume Yziquel <guillaume.yziquel@c...> |
| Subject: | Re: [Caml-list] problem creating .cma library |
Daniel Bünzli a écrit :
>> So if I want to call R code that multithreads with OCaml, I should write
>> something like
>>
>>> enter_blocking_section();
>>> PROTECT(e = R_tryEval(Sexp_val(sexp_list), R_GlobalEnv, &error));
>>> UNPROTECT(1);
>>> leave_blocking_section();
>> Am I correct?
>
> Yes, but the functions have now a caml_ prefix.
>
> Make sure that there is no interaction whatsoever with ocaml's runtime
> system (e.g. ocaml value allocation) between the two calls.
I will have interaction, because I plan to be able to make R call OCaml
code (not in the foreseeable future). But it's just a question of
wrapping the call back to Ocaml with a
caml_leave_blocking_section()
callingOCamlcode()
caml_enter_blocking_section()
construct. As far as I've understood.
> Note also that in case you need to use some caml value after the leave
> call you have to declare it with a CAMLparam macro as it may move
> during the blocking section even if the stub itself doesn't allocate.
Very helpful. Thanks a lot.
--
Guillaume Yziquel
http://yziquel.homelinux.org/