When I input #use "topfind" ;; in top-level manually, it works as below:
#use "topfind" ;;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads #use "topfind" ;;
- : unit = ()
However, when I put #use "topfind";; in ~/.ocamlinit file, it doesn’t work:
>cat ~/.ocamlinit
#use "topfind";;
#require "str";;
(* #use "money.ml" ;; *)
>ocaml
Objective Caml version 3.12.0
# #list ;;
Unknown directive `list'.
It seems a strange question, isn’t it?
Obviously ocaml doesn’t load that .ocamlinit. Put some print_endline in it to verify.
Some ideas:
ocamlis some (wrong) alias in your shell?strace -f -ttT -e open $(which ocaml)to see where it looks for ocamlinit.