找不到OCaml Mutex模块

时间:2013-06-19 10:25:39

标签: ocaml mutex

我尝试使用Mutex模块,例如Mutex.create(),但编译器说Unbound模块Mutex。它需要一些特殊的命名空间吗?感谢

1 个答案:

答案 0 :(得分:8)

toplevel

ocaml -I +threads

# #load "unix.cma";;
# #load "threads.cma";;
# Mutex.create ();;
- : Mutex.t = <abstr>

ocamlc

ocamlc -thread unix.cma threads.cma src.ml

对于 ocamlopt

ocamlopt -thread unix.cmxa threads.cmxa src.ml

对于 findlib

ocamlfind ocamlc -thread -package threads -linkpkg src.ml