From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id BC3D3823D9 for ; Thu, 8 Mar 2018 15:19:18 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=nicolas.ojeda.bar@lexifi.com; spf=SoftFail smtp.mailfrom=nicolas.ojeda.bar@lexifi.com; spf=None smtp.helo=postmaster@vrout30.yaziba.net Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=pra; client-ip=185.56.204.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: SoftFail (mail3-smtp-sop.national.inria.fr: domain of nicolas.ojeda.bar@lexifi.com is inclined to not designate 185.56.204.33 as permitted sender) identity=mailfrom; client-ip=185.56.204.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@vrout30.yaziba.net) identity=helo; client-ip=185.56.204.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="postmaster@vrout30.yaziba.net"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3ASmYv0hck5WAaThHEvAirXicGlGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxcW6ZB7h7PlgxGXEQZ/co6odzbaO6Oa4ASQp2tWoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/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nMfQl5vju?= =?us-ascii?q?jWU4mVAHZ6Wp04EXZGi9HvRhPkqWf2LhgswEEWcWpgo+S/HqiEHRGQJUMlS1VK?= =?us-ascii?q?849zcMMwO8CpuLEqKqi7GFzSH9JZBMYXxuF1aNDzLib46AVu0JbySOZMF7xG8q?= =?us-ascii?q?T7+kHqkg3haqPRTN7LhqIuPj0KEC/cbl1dNy4+TI0xYw+DB9Sc6UyUmJQnF1kG?= =?us-ascii?q?JOTDgzivMs6Xdhw0uOhPAry8dTEsZesrYQCl9jZMzsitdiAtW3YTrvO9KASVKo?= =?us-ascii?q?WNKjWGtjSt8hwtEPJU16Hof510yR72+RG7YQ0oezKtks6KuFhSr1KtZ8xXeA36?= =?us-ascii?q?4k3QF/H5l/cFa+j6s6zDD9Qo7El0LDz/S0b6MBwHWVsnaK32uEtQdeXRIiCag?= =?us-ascii?q?=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C3IADeRaFahyHMOLldHAEBAQQBAQoBA?= =?us-ascii?q?YQ2bygKg0aYFIEmXBOBA5Q9ggEKG4UKAoMDBxkMBS8UAQIBAQEBAQEBAQESAQE?= =?us-ascii?q?BCgsJCCgugjgkAYJHAQUjVhALCw0CAiYCAiISAQUBHAYThRkEAZ4zQIwTgiaIQ?= =?us-ascii?q?yaCHYEOhCeCLoZphGk4gwmCYgSaTwmGSYofjmGROA8DIIEHAjWBc3BPMQaCDAm?= =?us-ascii?q?COIIIdotmAQEB?= X-IPAS-Result: =?us-ascii?q?A0C3IADeRaFahyHMOLldHAEBAQQBAQoBAYQ2bygKg0aYFIE?= =?us-ascii?q?mXBOBA5Q9ggEKG4UKAoMDBxkMBS8UAQIBAQEBAQEBAQESAQEBCgsJCCgugjgkA?= =?us-ascii?q?YJHAQUjVhALCw0CAiYCAiISAQUBHAYThRkEAZ4zQIwTgiaIQyaCHYEOhCeCLoZ?= =?us-ascii?q?phGk4gwmCYgSaTwmGSYofjmGROA8DIIEHAjWBc3BPMQaCDAmCOIIIdotmAQEB?= X-IronPort-AV: E=Sophos;i="5.47,441,1515452400"; d="scan'208";a="257497554" Received: from vrout30.yaziba.net ([185.56.204.33]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Mar 2018 15:18:59 +0100 Received: from mtaout20.int.yaziba.net (mtaout20.int.yaziba.net [10.4.20.37]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout30.yaziba.net (mx10.yaziba.net) with ESMTPS id 91683521FA for ; Thu, 8 Mar 2018 15:18:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mtaout20.int.yaziba.net (Postfix) with ESMTP id 9E46B160470 for ; Thu, 8 Mar 2018 15:18:58 +0100 (CET) X-Virus-Scanned: amavisd-new at mtaout20.int.yaziba.net Received: from mtaout20.int.yaziba.net ([127.0.0.1]) by localhost (mtaout20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Gv76Nl4_GPvu for ; Thu, 8 Mar 2018 15:18:58 +0100 (CET) Received: from mail-ot0-f170.google.com (mail-ot0-f170.google.com [74.125.82.170]) by mtaout20.int.yaziba.net (Postfix) with ESMTPSA id 544B316028D for ; Thu, 8 Mar 2018 15:18:58 +0100 (CET) Received: by mail-ot0-f170.google.com with SMTP id 108so5523741otv.3 for ; Thu, 08 Mar 2018 06:18:58 -0800 (PST) X-Gm-Message-State: AElRT7Gy7pnyQBObO7RJrAD78FZ/u0X5SrZ23EQe6+J+AmJgRzxtORyD S6r+6jXNqpxMwnVpPiqzj/WYjUhNqOOQPCIv3cM= X-Google-Smtp-Source: AG47ELuMeMaDa259n954GMHnwzVp840lLP9+oXYc1YqXya4vJ9bk0tFlfI6FFU1oo8cEL61lXq85ztkb6yhMl+/Dhs8= X-Received: by 10.157.81.77 with SMTP id u13mr19961116oti.313.1520518736981; Thu, 08 Mar 2018 06:18:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.139.125 with HTTP; Thu, 8 Mar 2018 06:18:36 -0800 (PST) In-Reply-To: References: From: =?UTF-8?Q?Nicol=C3=A1s_Ojeda_B=C3=A4r?= Date: Thu, 8 Mar 2018 15:18:36 +0100 X-Gmail-Original-Message-ID: Message-ID: To: =?UTF-8?Q?Jocelyn_S=C3=A9rot?= Cc: caml users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgedtfedrkeeggdegjecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepjghfhfffkffuvfgtgfesthhqredttddtjeenucfhrhhomheppfhitgholhojshgpqfhjvggurggpueomrhcuoehnihgtohhlrghsrdhojhgvuggrrdgsrghrsehlvgigihhfihdrtghomheqnecuffhomhgrihhnpegtmhhirdgsvghsthenucfkphepjeegrdduvdehrdekvddrudejtdenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Subject: Re: [Caml-list] A question about custom toplevels Dear Jocely, I do not think this is currently possible. When you enter a phrase into the toplevel (custom or otherwise), it is compiled much the same way as if it had been written in a file and passed to ocamlc. To do so the compiler needs access to the signature information stored in the .cmi files of all referenced modules. This is completely independent of whether the code of those modules is linked into the toplevel or loaded separately which is what ocamlmktop is about. Note that it works the same way even for modules of the stdlib. The reason "it just works" in that case is because a flag "-I " is added implicitly. But if you pass the -nostdlib flag to the toplevel, this implicit flag is not added, and the toplevel will not be able to find the .cmi files of the stdlib in much the same way in cannot find foo.cmi. Best wishes, Nicol=C3=A1s On Thu, Mar 8, 2018 at 9:19 AM, Jocelyn S=C3=A9rot wrote: > Hello, > > I recently stumbled on a problem and am wondering whether it comes from a > misunderstanding or a bad usage. > > When a custom toplevel is built using the [ocamlmktop] program, it seems > that the modules which are =C2=AB included =C2=BB must be present in the = path when the > so-built toplevel is executed afterwards. > > For example, suppose that directory =C2=AB bar =C2=BB contains a file fo= o.ml, with, > let say the definition =C2=AB let v=3D100 =C2=BB. > Then, making > > ocamlfind ocamlc -c -o foo.cmo foo.ml > ocamlfind ocamlc -a -o foo.cma foo.cmo > ocamlfind ocamlmktop -o foo.top foo.cma > > creates foo.top, which, when executed, behaves has expected. > > $ ./foo.top > OCaml version 4.06.0 > > # Foo.v;; > - : int =3D 100 > > But, when trying to execute foo.top from another directory, for ex from > ../bar, i get the following error : > > $ ./bar/foo.top > OCaml version 4.06.0 > > # Foo.v;; > Error: Unbound module Foo > > The error disappears if i add option =C2=AB -I ./bar =C2=BB when lauching= foo.top (or, > equivently execute the directive =C2=AB #directory ./bar =C2=BB). > > Is there a way to build a =C2=AB self-contained =C2=BB custom toplevel wh= ich could be > executed without any explicit reference to the modules it included at > creation ? > > Jocelyn > > ps : i tried the -custom option but, not surprisingly, it does not solve = the > pb since it only refers to external C code.