caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jocelyn Sérot" <Jocelyn.Serot@univ-bpclermont.fr>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] A question about custom toplevels
Date: Thu, 8 Mar 2018 09:19:55 +0100	[thread overview]
Message-ID: <B61C96B9-EC10-495E-9B74-13DBA06C8034@univ-bpclermont.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

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 « included » must be present in the path when the so-built toplevel is executed afterwards. 

For example, suppose that directory « bar » contains  a file foo.ml, with, let say the definition « let v=100 ».
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 = 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 « -I ./bar » when lauching foo.top (or, equivently execute the directive « #directory ./bar »).

Is there a way to build a « self-contained » custom toplevel which 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.

[-- Attachment #2: Type: text/html, Size: 3017 bytes --]

             reply	other threads:[~2018-03-08  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08  8:19 Jocelyn Sérot [this message]
2018-03-08 14:18 ` Nicolás Ojeda Bär
2018-03-08 16:01   ` Jocelyn Sérot
2018-03-08 17:28   ` Alain Frisch
2018-03-12  5:50     ` Oleg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B61C96B9-EC10-495E-9B74-13DBA06C8034@univ-bpclermont.fr \
    --to=jocelyn.serot@univ-bpclermont.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).