如何将两个自定义OCaml模块与“corebuild”链接`

如何将两个自定义OCaml模块与“corebuild”链接`,ocaml,ocamlbuild,Ocaml,Ocamlbuild,我有两个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

我有两个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
如果运行相同的命令,但没有首先mkain测试可执行文件(test.native),则会出现以下错误:

File "_none_", line 1:
Error: Cannot find file test.cmx

如何获得指定的功能?

我不确定是否有办法使用编译器执行以下操作。但另一种解决方案是只打开nhc.ml内的模块,如下所示:

open Test
我得到了我想要的行为