Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
problem creating .cma library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ 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


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