caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] A question about custom toplevels
@ 2018-03-08  8:19 Jocelyn Sérot
  2018-03-08 14:18 ` Nicolás Ojeda Bär
  0 siblings, 1 reply; 5+ messages in thread
From: Jocelyn Sérot @ 2018-03-08  8:19 UTC (permalink / raw)
  To: caml users

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-12  5:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08  8:19 [Caml-list] A question about custom toplevels Jocelyn Sérot
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

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).