From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 A29597F0F9 for ; Tue, 24 Nov 2015 18:14:08 +0100 (CET) IronPort-PHdr: 9a23:Dp3LWR8TbPEveP9uRHKM819IXTAuvvDOBiVQ1KB80+0cTK2v8tzYMVDF4r011RmSDdidtKwP0rqempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lR8iN0Y/uh6ibwN76XUZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwuwwZgf8q9tZBXKPmZOx4COUAVHV1BVso/9XmvgXvSg6G531UEjlH00kAPw+QxQv/VxT1+gTnN+xw0TTSacTsSLk5XXKt8qptRRb1oCoBLHs94WbRzMJq2vF1uhWk8j5y2YPRYYzdGPt7f6XaNYcYSWtEX8BWfy5IBI6nc5ECAvZHNuFd+dqu72ASpAezUFH/TNjkzSVF0zqrhKA= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jdimino@janestreet.com; spf=Pass smtp.mailfrom=jdimino@janestreet.com; spf=None smtp.helo=postmaster@mxout1.mail.janestreet.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.112 as permitted sender) identity=mailfrom; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.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@mxout1.mail.janestreet.com) identity=helo; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout1.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0B9AAA2mlRWnHDIaSZehA5vBq5Xj22BZRcMhWwCgToHOhIBAQEBAQEBARABAQEBAQYWCU+CLYIIAQEEEhEdAQEsCwEPCwsNAgIJHQICIhIBBQEKEgYTEhCHdwMSAwqgMYExPjGKV3GEYwEFhlEDhHcBAQEBAQEBAwEBAQEBAQEBAQETBgp3hVOEfoRZgmIMLhOBMYYTDJA2hSSCcoUbgiSYWhIkgRcnAYI/DRYHgVZyhSsBAQE X-IPAS-Result: A0B9AAA2mlRWnHDIaSZehA5vBq5Xj22BZRcMhWwCgToHOhIBAQEBAQEBARABAQEBAQYWCU+CLYIIAQEEEhEdAQEsCwEPCwsNAgIJHQICIhIBBQEKEgYTEhCHdwMSAwqgMYExPjGKV3GEYwEFhlEDhHcBAQEBAQEBAwEBAQEBAQEBAQETBgp3hVOEfoRZgmIMLhOBMYYTDJA2hSSCcoUbgiSYWhIkgRcnAYI/DRYHgVZyhSsBAQE X-IronPort-AV: E=Sophos;i="5.20,339,1444687200"; d="scan'208";a="154986906" Received: from mxout1.mail.janestreet.com ([38.105.200.112]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Nov 2015 18:14:04 +0100 Received: from tot-qpr-mailcore1.delacy.com ([172.27.56.68] helo=tot-qpr-mailcore1) by mxout1.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1a1HAJ-00013F-9H for caml-list@inria.fr; Tue, 24 Nov 2015 12:14:03 -0500 X-JS-Flow: external Received: by tot-qpr-mailcore1 with JS-mailcore (0.1) (envelope-from ) id BWVJrb-AAAGTW-Hk; 2015-11-24 12:14:03.243247-05:00 Received: from mail-io0-f176.google.com ([209.85.223.176]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1a1HAJ-0002UK-4r for caml-list@inria.fr; Tue, 24 Nov 2015 12:14:03 -0500 Received: by ioc74 with SMTP id 74so26986887ioc.2 for ; Tue, 24 Nov 2015 09:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=G90alLWgj2T//PF+q+1mcoV3UUmdN9PVmyuAyetHvS0=; b=1mg4KicDxgzhn/9RiwgTAwGVvz6WvVazGIyoo3dpyHs3SuNTFLHs1Yi1cR+jhW967T 0kWZuOMqfmrG9O54876cPlJy/1TJmu+t9R4Zc/oHu5hnaxbCKJOJLl27vEQyLaHMD+hV H6/+vZ/jsjFThSsEnOODVICB+5VzfGuBxyr4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=G90alLWgj2T//PF+q+1mcoV3UUmdN9PVmyuAyetHvS0=; b=DvsBLJEIUd29EjKkv7Q6gEKzw4cjCVOjWvIELWmJv7iMY4zz1cqPXIxIBlcvgPu3+f tMRXKdlLf9Q9aF+JlQwmUGkTVqh2wlYNQyk7on0ZrUrMXFOyCAFb5pSpZEkiEqwhOQ4+ hLhh/wEaLFZjwIHDUhqskLMgrYWdH0PuSsgf3Hv09AQrsFJqCO2eZSUFDKDh1MwasTMe XxdetOcjeEi23rtskxsl1Jz4I00u20lmbCwvVDmHoyjZtS25/nvncfd0HFlySweNxwPE jgfjXLyknFOTh4NH7OyF5D6RlHMgehWO1RBPTxGmC8EDLKOYP68pvMVHZCihKpZwrsYX 72ww== X-Gm-Message-State: ALoCoQnUeyNZizJZmT8Oq1oA3dc2lRdGmodBTbwsSaBkM3y32+vduy3PMQeBt0ODcS+akUkkOdR7sAiJ4sQl66ajTqlCHOevWIzp87KFlG1N8Y+E++udoLYSoyPLqhPMByzW+eijUQHJ X-Received: by 10.107.131.226 with SMTP id n95mr29208967ioi.135.1448385242756; Tue, 24 Nov 2015 09:14:02 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.107.131.226 with SMTP id n95mr29208958ioi.135.1448385242608; Tue, 24 Nov 2015 09:14:02 -0800 (PST) Received: by 10.50.237.70 with HTTP; Tue, 24 Nov 2015 09:14:02 -0800 (PST) In-Reply-To: <5654971F.2070006@ens-lyon.fr> References: <5654971F.2070006@ens-lyon.fr> Date: Tue, 24 Nov 2015 17:14:02 +0000 Message-ID: From:Jeremie Dimino To:=?UTF-8?B?QXJtYcOrbCBHdcOpbmVhdQ==?= Cc:caml-list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-JS-Processed-by: mailcore Subject: Re: [Caml-list] Custom toplevel and ocamlbuild Did you try adding "Foo" at the beginning of myutop.mltop? foo.cmo needs to come before myutop_main.cmo and I suppose that ocamlbuild puts the cmo in the same order as the one specified in the .mltop unless the dependencies force reordering. The reason foo.cmo needs to come before is that OCaml run the initialization code of linked compilation units in the same order they are specified on the command line and the toplevel can only see modules that have been initialized. Myutop_main contains the entry point of the toplevel - i.e. the call to the interactive loop - so the toplevel doesn't have access to units that are linked after myutop_main.cmo. That's also the reason why you can't access Myutop_main from the custom toplevel. On Tue, Nov 24, 2015 at 4:58 PM, Arma=C3=ABl Gu=C3=A9neau wrote: > Hi list, > > I was trying to build a custom toplevel, bundled with my custom > modules, and encountered a few issues. > > Following the last advice given by gasche on this reddit post > https://www.reddit.com/r/ocaml/comments/3qjs1q/utop_is_a_much_better_topl= evel_than_ocaml_if_you/cwisrrj > I copy-pasted the files from examples/custom-utop, added a foo.ml file > containing "let x =3D 3", and added "Foo" at the end of myutop.mltop. > > Then, if I compile the custom toplevel using the provided Makefile > (which simply uses ocamlbuild and the builtin rule for .mltop files, I > guess), the toplevel produced does not have access to the Foo module. > > However, if I manually build using ocamlfind ocamlmktop: > > ocamlfind ocamlmktop -o myutop -thread -linkpkg -package utop foo.cmo > myutop_main.cmo > > this time, it works, and `myutop` has access to Foo. > > Is the default ocamlbuild rule for building .mltop files missing some > option? Am I doing something wrong? > > =E2=80=94 Arma=C3=ABl > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs --=20 Jeremie