当我#use "topfind" ;;
手动输入顶级时,它的工作原理如下:
#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 = ()
Run Code Online (Sandbox Code Playgroud)
然而,当我把#use "topfind";;
在~/.ocamlinit
文件中,这是行不通的:
>cat ~/.ocamlinit
#use "topfind";;
#require "str";;
(* #use "money.ml" ;; *)
>ocaml
Objective Caml version 3.12.0
# #list ;;
Unknown directive `list'.
Run Code Online (Sandbox Code Playgroud)
这似乎是一个奇怪的问题,不是吗?
显然ocaml不会加载.ocamlinit.在其中放入一些print_endline进行验证.一些想法:
ocaml
你的shell中有一些(错误的)别名?strace -f -ttT -e open $(which ocaml)
看看它在哪里寻找ocamlinit.