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