问题
I tried two commands to load Str Module in OCaml top level. The first command gives me the error "Cannot find file Str.cmo". I then tried to use the file i was using in top level with the second command. With that command i got "Reference to undefined global Str".
#load "Str.cmo";;
#use "my_file.ml";;
What do i need to do to successfully load Str module in OCaml top level.
回答1:
Modules are "archives", so they are .cma files, not .cmo:
# #load "str.cma";;
# Str.regexp;;
- : string -> Str.regexp = <fun>
回答2:
# #use "topfind"
# #require "str"
来源:https://stackoverflow.com/questions/37513046/using-str-module-in-ocaml-top-level