1

I tried to use Mutex module, such as Mutex.create(), but compiler says Unbound module Mutex. Does it require some special namespace? Thanks

user2465355
  • 375
  • 1
  • 3
  • 15

1 Answers1

9

For toplevel:

ocaml -I +threads

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

For ocamlc:

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

For ocamlopt:

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

For findlib:

ocamlfind ocamlc -thread -package threads -linkpkg src.ml
barti_ddu
  • 10,179
  • 1
  • 45
  • 53