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 c5ff346549e7 (Postfix) with ESMTPS id E474D5D4 for ; Thu, 8 Nov 2018 10:05:28 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.54,478,1534802400"; d="scan'208";a="354703628" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 08 Nov 2018 11:05:25 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 95470824F7; Thu, 8 Nov 2018 11:05:25 +0100 (CET) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 71A01824E4 for ; Thu, 8 Nov 2018 11:05:17 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=frederic.fort@univ-lille.fr; spf=Pass smtp.mailfrom=frederic.fort@univ-lille.fr; spf=None smtp.helo=postmaster@mx1.univ-lille.fr IronPort-PHdr: =?us-ascii?q?9a23=3ABeyRwRwpXbmuYV3XCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?1O8QIJqq85mqBkHD//Il1AaPAd2Eraocw8Pt8InYEVQa5piAtH1QOLdtbDQizf?= =?us-ascii?q?ssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1?= =?us-ascii?q?JuPoEYLOksi7ze+/94HRbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeu?= =?us-ascii?q?BWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbO?= =?us-ascii?q?SxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDwULs6Wymt771zRRHmiC?= =?us-ascii?q?kJKT03/nzYhcNsg6xboRWvpwBkzo7IeYGaKOZyc7nBcd4YQ2dKQ8ZfVzZGAoO5?= =?us-ascii?q?d4YBD/ABOvxFoI7nvVsOrAexDhSsCuPo0D9ImmL90Ko00+Q7Dw7JwRIvH8gPsH?= =?us-ascii?q?vIttn1OqASUfqpzKTT0DXDafJW2Snk5IjMcxAhpfWMUqxqfcrf00kiDgXIhUiT?= =?us-ascii?q?p4z9Jz6Zy+AAvmeB4+Z+Ve+ihHQrpxxvrjWr3MshhIfEipoIxlzY7yl13Yk4Kc?= =?us-ascii?q?GiREJmfdKoCptduzycOoBrWM0tWXtotzw/yrAeuZ60YiwKyJM/yh7aZP2LbpKE?= =?us-ascii?q?4g/lVOaQPzd0nXZleLO7hxa270es0OP8VtOs3FZLqCpKjMXMu2gQ2xHX5cWLUO?= =?us-ascii?q?Vx80eu1DqVygzf9OVJLVo6mKfVM5Ihx6Q/lpsXsUTNBC/2n0D2gbeYdkU+5Oen?= =?us-ascii?q?9vroYq/nppCALYN0hAb+Mr4ymsGkHOQ4NAkOX3aC9eS41b3j+Un5T6tQgv04iK?= =?us-ascii?q?nVqIraKtgDpq6lHw9V1Z4u5AqlADej1NQUhH0HLFNeeBKblIXpIFHPIPXgDfil?= =?us-ascii?q?mViskTFrx+rHPrL7GJnNIGLDw//deuN24ktYjQ4y1sx35pROC7hHLuigdFX2sY?= =?us-ascii?q?n2FJ41sha1yK7JD89hntcQQ2+DD7WYO+XctkWUzv8pIvfJYI4RvDu7JeJztK2m?= =?us-ascii?q?tmMwhVJIJfrh5pAQcn3tRq03cXXcWmLlh5I6KUlPuwM/SOLwj1jbDGxOYXesGq?= =?us-ascii?q?Y94jU2Toy8X96aGtKdxYeZ1SL+JaV4I3hcAwnRQ2rudpvBX/YIbC/ULNUzymVZ?= =?us-ascii?q?B4jkcJco0FSVjCG/y7djKbOFqCgI7NT+0tlrounSkRU/szJuXZyQ?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DOHQDzCORbhiGB/sJjghmCaE8zJwqDL?= =?us-ascii?q?z+Id4scNIE0ih+NOYF5DRuEUYMRGgcBBDcHDAEDAQECAQEBAQETAQEBCgkLCBs?= =?us-ascii?q?IAQUjDII2IoJ1FwQZAQExBxEBBhwCDRkCW4M4AYIFjBGaYHB7M4J2AQEFgj+Da?= =?us-ascii?q?4EGCIELim5WNIENgUSCMQEBhXeCN4JXiRqWMAcCgQpXhFGKfJBskA6HYoFdCoF?= =?us-ascii?q?pTSeDOAmCLIURgmKGMz4BAQEwjE6BHwEB?= X-IPAS-Result: =?us-ascii?q?A0DOHQDzCORbhiGB/sJjghmCaE8zJwqDLz+Id4scNIE0ih+?= =?us-ascii?q?NOYF5DRuEUYMRGgcBBDcHDAEDAQECAQEBAQETAQEBCgkLCBsIAQUjDII2IoJ1F?= =?us-ascii?q?wQZAQExBxEBBhwCDRkCW4M4AYIFjBGaYHB7M4J2AQEFgj+Da4EGCIELim5WNIE?= =?us-ascii?q?NgUSCMQEBhXeCN4JXiRqWMAcCgQpXhFGKfJBskA6HYoFdCoFpTSeDOAmCLIURg?= =?us-ascii?q?mKGMz4BAQEwjE6BHwEB?= X-IronPort-AV: E=Sophos;i="5.54,478,1534802400"; d="scan'208";a="354703548" Received: from mx1.univ-lille.fr ([194.254.129.33]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 11:05:17 +0100 Received: from smtp1.univ-lille.fr (smtp1.univ-lille.fr [10.140.10.72]) by mx1.univ-lille.fr (LA PUISSANCE) with ESMTP id E83CF441B8 for ; Thu, 8 Nov 2018 11:05:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=univ-lille.fr; s=dkim; t=1541671514; bh=PBX7/99RCg4ZFYUj+hkr6AbT/RZ3CrOptgluRfolXKU=; h=Date:From:To:Subject:From; b=uPTTMOV8E8kyh2icYnBwj46l71pHfdfzkYvZp0JlPMtwADYVlCadjsEuBo8bKXfpH lD3p5CBEOp6zrupjYWjGA/4YBTyqMFRodA8uJmBHJEzm61u5R+hZP0F6OO8aK6u1wq d+SYv1LpjAoNgIv4fOikV01UXJl1dBtPBEb8A1K4= Received: from zimbra-store01.univ-lille.fr (nat-interne-nsx-messagerie.univ-lille.fr [10.140.254.3]) by smtp1.univ-lille.fr (Postfix) with ESMTP id D37CF233BA for ; Thu, 8 Nov 2018 11:05:14 +0100 (CET) Date: Thu, 8 Nov 2018 11:05:14 +0100 (CET) From: =?utf-8?B?RnLDqWTDqXJpYw==?= Fort To: caml-list@inria.fr Message-ID: <1238750250.1711857.1541671514743.JavaMail.zimbra@univ-lille.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.140.10.51] X-Mailer: Zimbra 8.8.10_GA_3047 (ZimbraWebClient - FF63 (Linux)/8.8.10_GA_3041) Thread-Index: X+O/cSQiSucv1wzND6W1gZg+vV7AcA== Thread-Topic: Dynlink plugin reevaluates modules of main program X-UDL-MailScanner-Information: Please contact the ISP for more information X-UDL-MailScanner-ID: E83CF441B8.A7B68 X-UDL-MailScanner: Found to be clean X-UDL-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (not cached, score=-2.021, requis 6, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90, DKIM_SIGNED 0.10, DKIM_VALID -0.10, DKIM_VALID_AU -0.10, FROM_EXCESS_BASE64 0.98) X-UDL-MailScanner-From: frederic.fort@univ-lille.fr Subject: [Caml-list] Dynlink plugin reevaluates modules of main program Reply-To: =?utf-8?B?RnLDqWTDqXJpYw==?= Fort X-Loop: caml-list@inria.fr X-Sequence: 17122 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hello, I have an existing program and would like to allow to extend it's functiona= lities with plugins. If I simplify my code structure it looks as follows: - a.ml : "main module" of the program - b.ml : additional definitions used in a.ml - c.ml : interface for plugins (a collection of function refs) - d.ml : plugin I would like to load Now, d.ml uses values defined in b.ml. Some of them are of type string ref and it seems that the code of b.ml is reevaluated when I call Dynlink.loadfile "/path/to/d.cmxs" which resets them to the empty string. Is there a way to prevent this from happening ? Using allow_only and prohibit is not an option, since multiple plugins woul= d each reevaluate C and undo each others modifications. Yours sincerely, Fr=C3=A9d=C3=A9ric Fort P.S.: Here follows a minimal working example. I compiled it with ocamlbuild -use-ocamlfind -lib dynlink a.native ocamlbuild -use-ocamlfind d.cmxs a.ml: open Format let _ =3D B.str :=3D "abc"; printf "%s\n" !B.str; begin try Dynlink.loadfile "./_build/d.cmxs" with Dynlink.Error err -> failwith (Dynlink.error_message err) end; printf "%s\n" !B.str; match !C.f with | Some(f) -> printf "%s\n" (f 0) | None -> () b.ml: let str =3D ref "" c.ml: let f : (int -> string) option ref =3D ref None d.ml: let _ =3D C.f :=3D Some((fun x -> !B.str^(string_of_int x))) --=20 Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list Forum: https://discuss.ocaml.org/ Bug reports: http://caml.inria.fr/bin/caml-bugs=