0
我升级我的ocaml到4.03.0。 然后,一些包装库无法生成“没有提供实现”错误。在OCaml 4.03.0 FFI无法编译与“没有实现提供”错误
我准备一个小例子来解释我的情况。
我写在hello_stubs.c
#include<stdio.h>
#include<caml/mlvalues.h>
CAMLprim value caml_print_hello(value unit)
{
printf("Hello\n");
return Val_unit;
}
接着一个C代码,我制备接口文件为ocaml的,在hello.mli
。
external print_hello : unit -> unit = "caml_print_hello"
然后,我在main.ml
Hello.print_hello();;
编码一个主程序要编译这些程序,我执行以下命令。
ocamlc -c hello.mli
ocamlc -c hello_stubs.c
ocamlopt -o main main.ml hello_stubs.o
然后,不幸的是,最后一个命令失败,出现以下错误消息。
File "_none_", line 1:
Warning 58: no cmx file was found in path for module Hello, and its interface was not compiled with -opaque
File "main.ml", line 1:
Error: No implementations provided for the following modules:
Hello referenced from main.cmx
据消息, 我试过ocamlc -opaque hello.mli
,但它并没有解决问题。
我也确认上述命令对于ocaml 4.02.3工作正常。
你知道如何用ocaml 4.03.0编译这个例子吗?