Assume I have two .ml files: A.ml and B.ml.
In A.ml, I have
type my_type = {id_ary : int array; sz_ary : int array};;
In B.ml, I have
let test_my_type {id_ary;_} = id_ary.(0) <- 10;;
Then I compiled them like this
ocamlc -linkpkg A.ml B.ml -o C
But complier gives such an error: Error: Unbound record field label id_ary
It seems that B can’t use the type my_type from A.
What should I do?
add
open Ato the beginning of B.mlAlso just a heads up, it will be more convenient to build your code with:
ocamlbuild B.native(You will have to clean your code directory however)