[英]How do I link two custom OCaml modules with `corebuild`
我有两个OCaml模块,即nhc.ml和test.ml。 这两个模块都引用parser.mly,scanner.mll和ast.mli。
目标是拥有一个可执行文件,即nhc.native,在这里我仍然可以引用test.ml的功能。
./nhc.native fun_from_test
将两个模块分开工作:
corebuild nhc.native
corebuild test.native
但是当我尝试使用corebuild将两者链接如下时:
corebuild nhc.native -mod test
我得到错误:
Error: No implementations provided for the following modules:
Scanner referenced from test.cmx
Parser referenced from test.cmx
如果我运行相同的命令,而没有首先安装测试可执行文件(test.native),则会出现以下错误:
File "_none_", line 1:
Error: Cannot find file test.cmx
如何获得指定的功能?
我不确定是否可以使用编译器执行以下操作。 但是另一种解决方案是只按如下所示打开nhc.ml中的模块:
open Test
然后我得到了想要的行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.