How to build myutop_main.cmo (needed for custom utop)

"[email protected] [ocaml_beginners]" <[email protected]> 06 Jul 2016 00:04:00 -0700
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>

 

 
I am trying to create a custom utop. The documentation suggests something like

 ocamlfind ocamlmktop -o myutop -thread -linkpkg -package utop myutop_main.cmo

where myutop_main.ml is a one-line file consisting let () = UTop_main.main ().

So I did the following :

1) In .opam directory, create myutop_main.ml file with contents as above
2) In .opam directory, invoke ocamlbuild -r myutop_main.native

But this fails because of ocamlbuild hygiene violations.
What is the correct way to do it ?

Another question : the documentation's suggestion is somewhat unclear as the
code does not include any external library to be embedded in utop.

I suppose that if I have say, my_first.cmo and my_second.cmo, I should insert
them into the command as follows :

ocamlfind ocamlmktop -o myutop -thread -linkpkg -package utop my_first.cmo my_second.cmo myutop_main.cmo