English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2010-01-10 (02:11)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] problem creating .cma library
> 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.

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.

Best,

Daniel