Compilación separada de módulos OCaml
he leídoesta pregunta y otros, pero mi problema de compilación no está resuelto.
Estoy probando una compilación separada con estos archivos:
testmoda.ml
module Testmoda = struct
let greeter () = print_endline "greetings from module a"
end
testmodb.ml
module Testmodb = struct
let dogreet () = print_endline "Modul B:"; Testmoda.greeter ()
end
testmod.ml
let main () =
print_endline "Calling modules now...";
Testmoda.greeter ();
Testmodb.dogreet ();
print_endline "End."
;;
let _ = main ()
Ahora genero el archivo .mli
ocamlc -c -i testmoda.ml >testmoda.mli
y el testmoda.cmi está ahí.
A continuación, creo el archivo .cmo sin errores:
ocamlc -c testmoda.ml
Bien, haz lo mismo con testmodb.ml:
strobel@s131-amd:~/Ocaml/ml/testmod> ocamlc -c -i testmodb.ml >testmodb.mli
File "testmodb.ml", line 3, characters 45-61:
Error: Unbound value Testmoda.greeter
Otro intento:
strobel@s131-amd:~/Ocaml/ml/testmod> ocamlc -c testmoda.cmo testmodb.ml
File "testmodb.ml", line 3, characters 45-61:
Error: Unbound value Testmoda.greeter
Otras combinaciones fallaron también.
¿Cómo compilo testmodb.ml y testmod.ml? Esto debería ser fácil, sin ocamlbuild / omake / oasis, creo.
Los errores de sintaxis en los archivos están excluidos, si los juntamos en un archivo (con el espacio requerido entre ellos) se compila y ejecuta perfectamente.