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 D060A5D5 for ; Thu, 30 May 2019 14:20:33 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.60,531,1549926000"; d="scan'208";a="385371748" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 30 May 2019 16:20:32 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id A2505826E3; Thu, 30 May 2019 16:20:32 +0200 (CEST) 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 2C21F7ED69 for ; Thu, 30 May 2019 16:20:26 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=asai@is.ocha.ac.jp; spf=Pass smtp.mailfrom=asai@is.ocha.ac.jp; spf=None smtp.helo=postmaster@web.is.ocha.ac.jp IronPort-PHdr: =?us-ascii?q?9a23=3A0r5UmRbhLLaKUlRdwauqg5L/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZoMS7bnLW6fgltlLVR4KTs6sC17OP9fm6CCdfvd6oizMrSNR0TRgLiM?= =?us-ascii?q?EbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVr?= =?us-ascii?q?O+/7BpDdj9it1+C15pbffxhEiCCybL9vMRm6txjdutcSjIdtKKs8xQbCr2dVde?= =?us-ascii?q?hR2W5mP0+YkQzm5se38p5j8iBQtOwk+sVdT6j0fLk2QKJBAjg+PG87+MPktR/Y?= =?us-ascii?q?TQuS/XQcSXkZkgBJAwfe8h73WIr6vzbguep83CmaOtD2TawxVD+/4apnVAPkhS?= =?us-ascii?q?EaPDM/7WrZiNF/jLhDrRyvpxJx3ZPaboKbNPVxYqzSYNEVSmRaU8ZNSyBMGJ+w?= =?us-ascii?q?Y5cVAuYfO+tTsonzp0EJrRu7HQSiAf3gyjlJhnDq3a060vkqHB3d3AM6HtIFrX?= =?us-ascii?q?PZo8/uNKgIUOC416jIzS7ZY/NRxTj96JLHfgo7rv6QR75wc9LRxFApGgjYgFuQ?= =?us-ascii?q?ronlMCmU1uQLq2Wb7/ZgVeeri2I9qgFxuSCjxsgtionVhoIV10vL+T9lz4YyIN?= =?us-ascii?q?21TlNwb928EJZIqi2XOYV7TtkjTmxooio3y7ILtYSmcCQW0Jgr2gDTZvKdf4SW?= =?us-ascii?q?7B/vSPydLSp8iX9kYr6yhQu+/E69wePmTMa0ykxFri9dn9nMqH8N0xvT59CJS/?= =?us-ascii?q?Rj5UitwzeP1xvJ5uFDPU80lbDUJ4Q7zbEsjJYTs1zDEjf3mEXwkqCWal0p9vWm?= =?us-ascii?q?5unpeLnrp5+RO5V1hwzxKKgih9CzDfw9MgcUXmib/eq81Kfk/U38WLhFlOY2nb?= =?us-ascii?q?PYsJ3BJMQbvbS1AwhJ3YYj8RmzFS2p38gCkXkFNFJJYAiHgJTxO1HSPPD4Cu+y?= =?us-ascii?q?jEi2nzduw/DKJ7nhApTWLnjfi7rhZrZ860tEyAUp19xf5pRUCqsAIP3pQEPxus?= =?us-ascii?q?bYXVcFNFm03ungQIF9y4wZH2KCH72QKq/6vlqB5+ZpKO6JMtw7ojH4ftso4f/l?= =?us-ascii?q?jX5xsEQUfOH91IAeaVi5BbJhKEWQJ3PnxNUZRzRZ9jEiRfDn3QXRGQVYYGy/Cv?= =?us-ascii?q?plt2MLTbm+BIKGfbiDxbmI3SO1BJpTPz0UC0vKFnzofsONULEOcHDLe5Izonk/?= =?us-ascii?q?TbGkDrQZ+1SuuQv9kus1MefevCwD85Xo1NEz7uaVlwlgrWUoXfTY6HmESiRPpk?= =?us-ascii?q?1NXyU/hf0toFc7zVyD2O5xiLpaDY4L6g=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0A/AABV5u9cfQpAQYVlGgEBAQEBAgEBA?= =?us-ascii?q?QEHAgEBAQGBZYJ6UzEojQ+MFJpXAQgBAwEKAQElCAIBAYN6RgKCfRsHAQQ0EwE?= =?us-ascii?q?DAQEEAQECAQEDARMBAQsUCBsxDII6IoJuAQEBAwE6PwULCxgJJQ8FIAEFASITg?= =?us-ascii?q?yOBew4BD548PIxPiD0hgVcNAgOBIottgX+DJVAuPoJhAoUdgiYEiHgHgiWJBZR?= =?us-ascii?q?DCYIPghaEJYxcDBuDCIlNigMtk1GPAgIEAgQFAgYPIYFFgXkzGggwO4JsCYV2h?= =?us-ascii?q?CCGQjEygQMmE41JAQE?= X-IPAS-Result: =?us-ascii?q?A0A/AABV5u9cfQpAQYVlGgEBAQEBAgEBAQEHAgEBAQGBZYJ?= =?us-ascii?q?6UzEojQ+MFJpXAQgBAwEKAQElCAIBAYN6RgKCfRsHAQQ0EwEDAQEEAQECAQEDA?= =?us-ascii?q?RMBAQsUCBsxDII6IoJuAQEBAwE6PwULCxgJJQ8FIAEFASITgyOBew4BD548PIx?= =?us-ascii?q?PiD0hgVcNAgOBIottgX+DJVAuPoJhAoUdgiYEiHgHgiWJBZRDCYIPghaEJYxcD?= =?us-ascii?q?BuDCIlNigMtk1GPAgIEAgQFAgYPIYFFgXkzGggwO4JsCYV2hCCGQjEygQMmE41?= =?us-ascii?q?JAQE?= X-IronPort-AV: E=Sophos;i="5.60,531,1549926000"; d="scan'208";a="307691328" X-MGA-submission: =?us-ascii?q?MDE01DC/VrC8A3qdgCJD4BZ1nSkqC9F51f/bse?= =?us-ascii?q?A0Xu5EJkM5JsCEunRiDj597R134J7YwXfd5zrUcZMjYOdNQ3WqeeiC34?= =?us-ascii?q?mfQbI9etaz9uUH2gyt3ISry4KgQ5nO/AgSAng8/F3/6Z17unaXHZSjnG?= =?us-ascii?q?yjvLP2HAItspkTd121muFRCw=3D=3D?= Received: from web.is.ocha.ac.jp ([133.65.64.10]) by mail3-smtp-sop.national.inria.fr with ESMTP; 30 May 2019 16:19:46 +0200 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by web.is.ocha.ac.jp (Postfix) with ESMTP id E2CD820075382 for ; Thu, 30 May 2019 23:19:44 +0900 (JST) Received: by mail-pf1-f200.google.com with SMTP id g11so4703259pfq.7 for ; Thu, 30 May 2019 07:19:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=LUjgBKAHccOqL0AZNaJ7w0r7IEp8Bn3sot+mHbhCvmY=; b=nnjLmr59G7OKMicoOWm2/pr11wtooXNgGObLNTOLIiAxcAknRFVUNFhsdsI7H9JUbW YtF58BIw6SP+fyAyPKKc/PYX8XNnUxbQW7492ZkqWEPlZ4OpvNNYHpiyGPC40u53a/Zr rhOU57S2IS8l1guCZi3oXR1BpX1EsgVMDYM2YD/9Z7MWNFxCgmXhw/tI/KJwh05ZvEbZ pMnRaDrWB/X5H4XQEtELkWxhMDOVue48V4xVrqTFMG6zXiu9e3GXrsyivW9H+WSUT43B QMJFDq6vzaz9j64r/J4KdoZXEXHbrXVcnMrBtfIR20sR3SBDXH+Hg+hquHWq93zQpEMy FgzQ== X-Gm-Message-State: APjAAAWyCKVMtc5g4ADqrELKqbZdxJgwCOuIjIWQKAcRZapjRFBfkWFN +3wTR4o4LQMsJYi9L8vUmM+FcXsD/y8E68xFU0PaXH8NbciQ6ttOR1u5i3BPfVWVWVGG22+mdoD JWzXKOL2hy2sS X-Received: by 2002:a63:f957:: with SMTP id q23mr3997089pgk.326.1559225984076; Thu, 30 May 2019 07:19:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyojOqoFoKFksd3UmSYCIr369jhLmkhVYP49U5Bcx7JK4ysaFqc9Cyj++7DX7gulf8w1TRSRQ== X-Received: by 2002:a63:f957:: with SMTP id q23mr3997072pgk.326.1559225983725; Thu, 30 May 2019 07:19:43 -0700 (PDT) Received: from localhost (123.230.196.71.er.eaccess.ne.jp. [123.230.196.71]) by smtp.gmail.com with ESMTPSA id t187sm2971580pfb.64.2019.05.30.07.19.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 May 2019 07:19:42 -0700 (PDT) Date: Thu, 30 May 2019 23:19:33 +0900 From: Kenichi Asai To: hugo Cc: caml-list@inria.fr Message-ID: <20190530141933.GA93967@pllab.is.ocha.ac.jp> References: <20190526062659.GA63981@pllab.is.ocha.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Subject: Re: [Caml-list] How can I use a library in a toplevel created by js_of_ocaml? Reply-To: Kenichi Asai X-Loop: caml-list@inria.fr X-Sequence: 17595 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: Thank you for the e-mail. It goes great. Going one step further, can I do the same if I install fac as an opam library? Suppose I packaged fac.ml as a library called myFac and installed fac.cma and fac.cmi via opam. Using: (action (run jsoo_listunits -o %{targets} stdlib myFac)) I could compile it but I got the "Unbound module Fac" error when I open index.html. Is listing myFac in the above line not enough? As a related question, is there a document I can study that describes: - what jsoo_listunits does, and - what the --export option (and other options) of js_of_ocaml does? -- Kenichi Asai On Tue, May 28, 2019 at 08:41:01AM +0800, hugo wrote: > You need to tell js_of_ocaml the list of cmi that you want to export. > [jsoo_listunits] can compute the list of cmi from a findlib library. > Because fac is not installed, you'll need to be explicit. > There might be some better wait to integrate with dune but the following > should change should do what you want. > > (rule > (targets export.txt) > (deps eval.bc fac/fac.cma) > (action (run jsoo_listunits -o %{targets} stdlib fac/.fac.objs/byte/fac.cmi))) > > H > > > On Sun, May 26, 2019 at 2:27 PM Kenichi Asai wrote: > > > I want to create a web page where I can execute an OCaml expression > > that mentions a prebuilt user-defined library. I find the following > > example in the js_of_ocaml/toplevel repository: > > > > https://github.com/ocsigen/js_of_ocaml/tree/master/toplevel/examples/eval > > > > Can I extend this example so that the toplevel is compiled with a > > user-defined library? The attached program contains the following > > where the first three files are copied from the example in the > > js_of_ocaml/toplevel repository. > > > > toplevel/ -- dune > > -- eval.ml > > -- index.html > > -- fac/ -- dune > > -- fac.ml > > > > I intend that fac.ml is compiled as a library and I want to use it in > > the toplevel. I added "fac" in the libraries stanza of the toplevel > > dune file (as in the attached file): > > > > (executables > > (names eval) > > (libraries > > fac > > js_of_ocaml-compiler > > js_of_ocaml-toplevel) > > (link_flags (:standard -linkall)) > > (preprocess (pps js_of_ocaml-ppx))) > > > > Naturally, fac.ml is compiled and I can use it in the eval.ml, but it > > is not visible from the toplevel. I included the following part in > > the index.html (as in the attached file): > > > > > >
> > > > but the output says: > > > > File "/dev/fake_stdin", line 2, characters 6-12: > > Error: Unbound module Fac > > > > Thank you in advance. > > > > -- > > Kenichi Asai