I'm not experienced in ocaml, my situation here is that I'm writing my ocaml code, I try to access the types that defined in other .ml files, which locate outside of my project root directory. I tried to set up _oasis, however when I specify the library field, the Path value is invalid as I try to use "../../dir". Does anyone know how can I achieve this goal? I don't want to copy them into my project root directory, as I was looking through those tutorials, haven't found a solution yet, thanks!
How can I open modules defined outside my project root directory in my ocaml file?
491 views Asked by Cyrus At
1
The idea of oasis is that you have one
_oasis
file in the root directory of your project, and that file defines the whole project. Hence, all the paths are specified relative to the root folder (the one that contains_oasis
)In your case, the project structure could look like this:
And an
_oasis
file that corresponds to it would be:Finally, since merlin now is a tool de facto, you shall also consider teaching him your project structure, by adding the
.merlin
file to the root folder of your project with the following contents:If you have any external dependencies, you can add them to
.merlin
usingPKG <findlib-name-of-the-dep>
, e.g.,PKG core_kernel
. And, of course, you should add your external dependencies to you libraries and applications in the _oasis file, by using theBuildDepends
clause, e.g.,BuildDepends: core_kernel
.