I have an interpreter.ml
file that contains an interpreter and some type
definitions.
I've developed some test batteries to check if the interpreter works well or not.
When I put the functions I use to test the behaviour of the interpreter in the same file of the interpreter all works well, but if I try to use a different file for the tests (let's say tests.ml
) it did not load the interpreter functions and definitions.
the interpreter.ml
and tests.ml
are in the same folder
I tried both with open Interpreter
and #use "./interpreter.ml"
from inside tests.ml
but it wont compile nor shut down the warnings in the IDE (kind of...I'm using Visual Studio Code on MacOs )
I've already tried to follow the official documentation but it won't compile with ocamlopt -c tests.ml
As a result of discussions, the executable is obtained by compiling the 2 files test.ml
& interpreter.ml
in the right order ( test.ml
relies on objects defined in interpreter.ml
; as a consequence test.ml
has to reference to interpreter objects either via the clause open Interpreter
or by prefixing all relevant items with Interpreter
):
ocamlc -o exec interpreter.ml test.ml
ocamlbuild
is easier as it resolves by itself the dependencies: The following command:
ocamlbuild test.native
will produce the executable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.