From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2F1D8BBAF for ; Sun, 10 Jan 2010 03:11:57 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqABAD7GSEvRVdvRkGdsb2JhbACDXpc9PwEBAQEJCQwHEwOrYIFbhGSFewECAwWBJoIuVgSCfogw X-IronPort-AV: E=Sophos;i="4.49,249,1262559600"; d="scan'208";a="41113156" Received: from mail-ew0-f209.google.com ([209.85.219.209]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Jan 2010 03:11:56 +0100 Received: by ewy1 with SMTP id 1so2047813ewy.8 for ; Sat, 09 Jan 2010 18:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=KQ/cTvEg8PRiY4AHUipZx58jCu5dn7mePulWLuo6LcQ=; b=edllCsBYMdr+H5UnwklJO9oGiXrzx+I3MdBS5ceP0R4SKMXFN74TgxSsCWo0paBvMp LNzwp3Lo2uXCk3h2roBHAZ2iM/HBnh/Q7hSSO1KMpJSgx2dkMfElkxcB0Y6KAzJUWhHQ 0SHMBCAehwPdiwNZzVcjp5gBZ+W9zkjJ2sPh8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=bs42UXZcnodIEnT3cDp0QtO+cqN5BwvjXzd/puf9UQw6Qz6yYZxNEAJTnv1Z+dyLpl iz8VtZbDrS8ECI/tElDPNKRivHI6Th5CCK8osvmX0kwgdvZ2HMIMVnyoimc19dLeAwGu nqvS5qJJSaaSPrgqH7kPYVXG1cDBDj5NkFyZc= MIME-Version: 1.0 Sender: daniel.c.buenzli@gmail.com Received: by 10.213.100.65 with SMTP id x1mr6388674ebn.67.1263089516324; Sat, 09 Jan 2010 18:11:56 -0800 (PST) In-Reply-To: <4B48DAA7.3070400@citycable.ch> References: <56670.41.177.16.252.1262195331.squirrel@41.177.16.252> <3EE07409-9559-4B91-BA3E-8787D1378275@inria.fr> <4B47C201.7090201@citycable.ch> <4B47C59C.9080505@starynkevitch.net> <4B47C9BE.4060309@citycable.ch> <001f01ca9101$7ee76850$7cb638f0$@romulus.metastack.com> <4B486974.7060007@citycable.ch> <20100109125224.GC26610@annexia.org> <91a3da521001090600y2a456e3dg98200cd84d8bf082@mail.gmail.com> <4B48DAA7.3070400@citycable.ch> Date: Sun, 10 Jan 2010 11:11:56 +0900 X-Google-Sender-Auth: 7cebe9ef0778c19d Message-ID: <91a3da521001091811n6a972e84l3dfcae92f4dfae93@mail.gmail.com> Subject: Re: [Caml-list] problem creating .cma library From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: guillaume.yziquel@citycable.ch Cc: caml-list List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; buenzli:01 multithreads:01 ocaml:01 sexp:01 val:01 sexp:01 ocaml's:01 runtime:01 ocaml:01 camlparam:01 stub:01 caml-list:01 functions:01 cma:01 caml:02 > So if I want to call R code that multithreads with OCaml, I should write > something like > >> =C2=A0enter_blocking_section(); >> =C2=A0PROTECT(e =3D R_tryEval(Sexp_val(sexp_list), R_GlobalEnv, &error))= ; >> =C2=A0UNPROTECT(1); >> =C2=A0leave_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