加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在OCaml源代码中使用Unix函数

发布时间:2020-12-15 22:07:15 所属栏目:安全 来源:网络整理
导读:我有一个函数来使用函数time.ml中的unix gettimeofday()来获取当前时间.该文件以下列方式访问该函数: open Unix; (*declared at the top of the file*)let get_time () = Unix.gettimeofday () .mli文件中的相应条目如下所示: val get_time : unit - float
我有一个函数来使用函数time.ml中的unix gettimeofday()来获取当前时间.该文件以下列方式访问该函数:

open Unix; (*declared at the top of the file*)

let get_time ()  = Unix.gettimeofday ()

.mli文件中的相应条目如下所示:

val get_time : unit -> float

但在编译期间会抛出错误:

File "_none_",line 1,characters 0-1:
No implementations provided for the following modules:
Unix referenced from time.cmx

我已检查/ lib / ocaml目录中是否存在以下文件:

unix.cmi,unix.a unix.cma unix.cmx unix.cmxa unix.cmxs unix.mli

并且路径设置正确设置为.bashrc文件.

LD_LIBRARY_PATH=~/lib

尽管存在于同一个/ lib / ocaml目录中,但来自Printf模块的fprintf等其他函数也能正常工作.

什么想法可能是错的?我做错了什么或者我错过了什么?

解决方法

你必须像这样编译:

ocamlc unix.cma -c time.mli time.ml (* bytecode *)

要么

ocamlopt unix.cmxa -c time.mli time.ml  (* native code *)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读